Click to See Complete Forum and Search --> : Error in Validating the XML


kul_bhat
September 5th, 2008, 05:38 AM
Hi,


While calling the validate method I am getting the following error while validating the XML:
<b>"Validate failed because the document does not contain exactly one root node."</b>

The XMLDOM object i am creating is Msxml2.DOMDocument.4.0

I am having only one root but don't know why this error

Here is my XSD:
<xsd:schema id="XSDSchemaTest" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="DriverDetails">
<xsd:sequence>
<xsd:element name="VendorURLPath" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="DriverCureServerURLPath" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="MD5" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="ProductName" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="DriverVersionInfo" type="xsd:string" minOccurs="1" maxOccurs="1" />
<xsd:element name="ContentWriterInfo" type="xsd:string" minOccurs="1" maxOccurs="1" />
</xsd:sequence>
</xsd:complexType>
<xsd:element name="Drivers">
<xsd:complexType>
<xsd:choice>
<xsd:element name="Driver" type="DriverDetails" />
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>

And here is the XML :

<?xml version="1.0" encoding="UTF-8" ?>
<Drivers xsd:SchemaLocation="F:\kuldeep\ProjectWork\XMLExtractorMFC\XMLSchema.xsd">
<Driver>
<VendorURLPath123>http://www.yahoo.com</VendorURLPath123>
<DriverCureServerURLPath>http://www.yahoo.com</DriverCureServerURLPath>
<MD5>12345678</MD5>
<ProductName123>abcd</ProductName123>
<DriverVersionInfo>Version No 1.1</DriverVersionInfo>
<ContentWriterInfo>Made By Microsoft</ContentWriterInfo>
</Driver>
</Drivers>

Anyone Please let me know what can be problem with this.

Kuldeep