|
Re: Is xsd validator cannot validate an xpath with character [ or ] ? [message #77770 is a reply to message #77753] |
Thu, 28 May 2009 17:08 |
Ed Merks Messages: 33264 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>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Re: Is xsd validator cannot validate an xpath with character [ or ] ? [message #604216 is a reply to message #77753] |
Thu, 28 May 2009 17:08 |
Ed Merks Messages: 33264 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>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.05523 seconds