You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-users@xerces.apache.org by Nagesh <na...@huawei.com> on 2008/06/09 11:34:47 UTC
Query in Schema Validation
Hi Group,
I have a query in xerces-C++ parser regarding the validation of input
xml document against it's schema document. I am not able to provide the
correct value for the parameter, SchemaLocation in the input xml document. I
went through the mailing list mails regarding the information for the usage
of SchemaLocation, but with no much relevant information which I can apply
to get the validation done. Somebody please suggest the correct way of using
it. Since I am new to Xerces, don't know the much usage of the same. Both
schema file and xml file is in the same folder in the file system.
I am getting the following error in xerces validation,
"The schemaLocation attribute does not contain pairs of values."
My schema file:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
elementFormDefault="qualified">
<xs:element name="a">
<xs:complexType>
<xs:sequence>
<xs:element ref="b"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="b">
<xs:complexType/>
</xs:element>
</xs:schema>
My xml File:
<?xml version="1.0" encoding="UTF-8"?>
<a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:SchemaLocation="http://www.w3.org/2001/XMLSchema a.xsd">
<b/>
</a>
Awaiting a positive response.
Thanks,
Nagesh.
Re: Query in Schema Validation
Posted by Alberto Massari <am...@datadirect.com>.
Given that your schema doesn't define a target namespace, you should use
xsi:noNamespaceSchemaLocation="a.xsd" in your XML file.
Alberto
Nagesh wrote:
> Hi Group,
>
> I have a query in xerces-C++ parser regarding the validation of input
> xml document against it's schema document. I am not able to provide the
> correct value for the parameter, SchemaLocation in the input xml document. I
> went through the mailing list mails regarding the information for the usage
> of SchemaLocation, but with no much relevant information which I can apply
> to get the validation done. Somebody please suggest the correct way of using
> it. Since I am new to Xerces, don't know the much usage of the same. Both
> schema file and xml file is in the same folder in the file system.
>
> I am getting the following error in xerces validation,
>
> "The schemaLocation attribute does not contain pairs of values."
>
>
>
> My schema file:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
> elementFormDefault="qualified">
>
> <xs:element name="a">
>
> <xs:complexType>
>
> <xs:sequence>
>
> <xs:element ref="b"/>
>
> </xs:sequence>
>
> </xs:complexType>
>
> </xs:element>
>
> <xs:element name="b">
>
> <xs:complexType/>
>
> </xs:element>
>
> </xs:schema>
>
>
>
> My xml File:
>
> <?xml version="1.0" encoding="UTF-8"?>
>
> <a xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:SchemaLocation="http://www.w3.org/2001/XMLSchema a.xsd">
>
> <b/>
>
> </a>
>
> Awaiting a positive response.
>
>
>
> Thanks,
>
> Nagesh.
>
>
>