Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » XML Schema Definition (XSD) » Is xsd validator cannot validate an xpath with character [ or ] ?
Is xsd validator cannot validate an xpath with character [ or ] ? [message #77753] Thu, 28 May 2009 12:02 Go to next message
Toan is currently offline Toan
Messages: 36
Registered: July 2009
Member
Hi everyone, is that xsd validator cannot validate an xml schema with an
xpath having character [ or ] ? I have this question because when I
validate a schema with xpath having predicates which are embedded in
square brackets (like the following), I have the problem. In the contrary,
I don't have. If yes, is there any way to introduce an xpath with
predicates without having problems in validating?
Thanks in advance.
Toan.

<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:element name="Model" type="Model">
<xsd:key name="EntityKey">
<xsd:selector xpath=".//*[entityName]" />
<xsd:field xpath=".//entityName" />
</xsd:key>
<xsd:keyref name="SourceRef" refer="EntityKey">
<xsd:selector xpath=".//*[Source]" />
<xsd:field xpath=".//Source" />
</xsd:keyref>
<xsd:keyref name="DestinationRef" refer="EntityKey">
<xsd:selector xpath=".//*[Destination]" />
<xsd:field xpath=".//Destination" />
</xsd:keyref>
</xsd:element>
<xsd:complexType name="Model">
<xsd:sequence>
<xsd:element default="model" minOccurs="0" name="modelNameElement"
type="xsd:string" />
<xsd:element default="documentation" minOccurs="0"
name="documentationElement" type="xsd:string" />
<xsd:element minOccurs="0" name="modelXSDFile" type="xsd:string"
/>
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="BasicEntity" type="BasicEntity" />
<xsd:element maxOccurs="unbounded" minOccurs="0"
name="Communicator" type="Communicator" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="BasicEntity">
<xsd:sequence>
<xsd:element default="BasicEntity" minOccurs="0"
name="entityName" type="xsd:string" />
<xsd:element default="BasicEntity" minOccurs="0"
name="entityTypeName" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="Communicator">
<xsd:sequence>
<xsd:element minOccurs="1" name="Destination"
type="xsd:string" />
<xsd:element minOccurs="1" name="Source" type="xsd:string"
/>
<xsd:element default="Communicator" minOccurs="0"
name="name"
type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
Re: Is xsd validator cannot validate an xpath with character [ or ] ? [message #77770 is a reply to message #77753] Thu, 28 May 2009 13:08 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25924
Registered: July 2009
Senior Member
Toan,

No, only restricted XPaths are allowed. See section 3.11.6 of the
specification for what's valid...


Toan wrote:
> Hi everyone, is that xsd validator cannot validate an xml schema with
> an xpath having character [ or ] ? I have this question because when I
> validate a schema with xpath having predicates which are embedded in
> square brackets (like the following), I have the problem. In the
> contrary, I don't have. If yes, is there any way to introduce an xpath
> with predicates without having problems in validating? Thanks in advance.
> Toan.
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:element name="Model" type="Model">
> <xsd:key name="EntityKey">
> <xsd:selector xpath=".//*[entityName]" />
> <xsd:field xpath=".//entityName" />
> </xsd:key>
> <xsd:keyref name="SourceRef" refer="EntityKey">
> <xsd:selector xpath=".//*[Source]" />
> <xsd:field xpath=".//Source" />
> </xsd:keyref>
> <xsd:keyref name="DestinationRef" refer="EntityKey">
> <xsd:selector xpath=".//*[Destination]" />
> <xsd:field xpath=".//Destination" />
> </xsd:keyref>
> </xsd:element>
> <xsd:complexType name="Model">
> <xsd:sequence>
> <xsd:element default="model" minOccurs="0"
> name="modelNameElement"
> type="xsd:string" />
> <xsd:element default="documentation" minOccurs="0"
> name="documentationElement" type="xsd:string" />
> <xsd:element minOccurs="0" name="modelXSDFile"
> type="xsd:string" />
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="BasicEntity" type="BasicEntity" />
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="Communicator" type="Communicator" />
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="BasicEntity">
> <xsd:sequence>
> <xsd:element default="BasicEntity" minOccurs="0"
> name="entityName" type="xsd:string" />
> <xsd:element default="BasicEntity" minOccurs="0"
> name="entityTypeName" type="xsd:string" />
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="Communicator">
> <xsd:sequence>
> <xsd:element minOccurs="1" name="Destination"
> type="xsd:string" />
> <xsd:element minOccurs="1" name="Source"
> type="xsd:string" />
> <xsd:element default="Communicator" minOccurs="0"
> name="name"
> type="xsd:string" />
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
>
Re: Is xsd validator cannot validate an xpath with character [ or ] ? [message #604216 is a reply to message #77753] Thu, 28 May 2009 13:08 Go to previous message
Ed Merks is currently offline Ed Merks
Messages: 25924
Registered: July 2009
Senior Member
Toan,

No, only restricted XPaths are allowed. See section 3.11.6 of the
specification for what's valid...


Toan wrote:
> Hi everyone, is that xsd validator cannot validate an xml schema with
> an xpath having character [ or ] ? I have this question because when I
> validate a schema with xpath having predicates which are embedded in
> square brackets (like the following), I have the problem. In the
> contrary, I don't have. If yes, is there any way to introduce an xpath
> with predicates without having problems in validating? Thanks in advance.
> Toan.
>
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema">
> <xsd:element name="Model" type="Model">
> <xsd:key name="EntityKey">
> <xsd:selector xpath=".//*[entityName]" />
> <xsd:field xpath=".//entityName" />
> </xsd:key>
> <xsd:keyref name="SourceRef" refer="EntityKey">
> <xsd:selector xpath=".//*[Source]" />
> <xsd:field xpath=".//Source" />
> </xsd:keyref>
> <xsd:keyref name="DestinationRef" refer="EntityKey">
> <xsd:selector xpath=".//*[Destination]" />
> <xsd:field xpath=".//Destination" />
> </xsd:keyref>
> </xsd:element>
> <xsd:complexType name="Model">
> <xsd:sequence>
> <xsd:element default="model" minOccurs="0"
> name="modelNameElement"
> type="xsd:string" />
> <xsd:element default="documentation" minOccurs="0"
> name="documentationElement" type="xsd:string" />
> <xsd:element minOccurs="0" name="modelXSDFile"
> type="xsd:string" />
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="BasicEntity" type="BasicEntity" />
> <xsd:element maxOccurs="unbounded" minOccurs="0"
> name="Communicator" type="Communicator" />
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="BasicEntity">
> <xsd:sequence>
> <xsd:element default="BasicEntity" minOccurs="0"
> name="entityName" type="xsd:string" />
> <xsd:element default="BasicEntity" minOccurs="0"
> name="entityTypeName" type="xsd:string" />
> </xsd:sequence>
> </xsd:complexType>
> <xsd:complexType name="Communicator">
> <xsd:sequence>
> <xsd:element minOccurs="1" name="Destination"
> type="xsd:string" />
> <xsd:element minOccurs="1" name="Source"
> type="xsd:string" />
> <xsd:element default="Communicator" minOccurs="0"
> name="name"
> type="xsd:string" />
> </xsd:sequence>
> </xsd:complexType>
> </xsd:schema>
>
>
Previous Topic:Is xsd validator cannot validate an xpath with character [ or ] ?
Next Topic:Question Regarding Schemas in WSDL
Goto Forum:
  


Current Time: Mon Jul 28 06:25:20 EDT 2014

Powered by FUDForum. Page generated in 0.08146 seconds