[xsd-users] XML validation problems

Boris Kolpackov boris at codesynthesis.com
Wed Dec 3 15:18:44 EST 2008


Hi Aamir,

aamir.mohammad at aon.ca <aamir.mohammad at aon.ca> writes:

> The XSD C++/Tree documentation uses the following XML as an example:
> 
> <?xml version="1.0"?>
> <hello xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>        xsi:noNamespaceSchemaLocation="hello.xsd">
>   <greeting>Hi</greeting>
>   <name>sun</name>
> </hello>
> 
> I want to be able to parse XML with the following format:
> 
> <?xml version="1.0"?>
> <hello>
>   <greeting>Hi</greeting>
>   <name>sun</name>
> </hello>
> 
> 
> Is this possible?  I don't want to have to include xmlns stuff.

Yes, you can parse this XML. You will, however, need to either
disable XML Schema validation in the underlying XML parser or
supply the schema information in an alternative way. For details,
please see Section 5.1, "XML Schema Validation and Searching" in
the C++/Tree Mapping User Guide:

http://www.codesynthesis.com/projects/xsd/documentation/cxx/tree/guide/#5.1


> Ideally I would like to be able to drop the <?xml version="1.0"?>
> part as well, so that I am able to parse the following text:
> 
> <hello>
>   <greeting>Hi</greeting>
>   <name>sun</name>
> </hello>

XML declaration (that's what this part is called) is optional so
there shouldn't be any problem with removing it.

Boris




More information about the xsd-users mailing list