I have the following XML and XSD files: ********************* XML file *********************
<?xml version="1.0"?> <x:books xmlns:x="urn:BookStore" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="urn:BookStore books.xsd"> <book id="bk001"> <author>Writer</author> <title>The First Book</title> <genre>Fiction</genre> <price>44.95</price> <pub_date>2000-10-01</pub_date> <review>An amazing story of nothing.</review> </book> <book id="bk002"> <author>Poet</author> <title>The Poet's First Poem</title> <genre>Poem</genre> <price>24.95</price> <pub_date>2001-10-01</pub_date> <review>Least poetic poems.</review> </book> </x:books> *********************** XSD file: *********************** <xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:BookStore" xmlns:bks="urn:BookStore"> <xsd:element name="books" type="bks:BooksForm"/> <!-- what if this line was not there! --> <xsd:complexType name="BooksForm"> <xsd:sequence> <xsd:element name="book" type="bks:BookForm" minOccurs="0" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType> <xsd:complexType name="BookForm"> <xsd:sequence> <xsd:element name="author" type="xsd:string"/> <xsd:element name="title" type="xsd:string"/> <xsd:element name="genre" type="xsd:string"/> <xsd:element name="price" type="xsd:float" /> <xsd:element name="pub_date" type="xsd:date" /> <xsd:element name="review" type="xsd:string"/> </xsd:sequence> <xsd:attribute name="id" type="xsd:string"/> </xsd:complexType> </xsd:schema> ************************ The Question ************************ So I could do the following which works fine: auto_ptr<BooksForm> bookBank (books( "books.xml" )); My question is what what if root note in xml doesn't have corresponding complexType definition in XSD file (it is used without giving it identifier)? How will we declare the C++ instance in that case? Is type definition necessary for ALL nodes in xml including the root node? Thanks Shahzad