The root element error is reported correctly here with both Xerces 2.6.2 and the latest CVS version.
I am not sure why it isnt working for you.

Thanks

Ankit Pasricha
XML Parser Development
IBM Toronto Lab
8200 Warden Avenue, Ontario L6G 1C7
Phone: (905) 413 4941



Subbu Iyer <[EMAIL PROTECTED]>

01/26/2005 04:33 PM

Please respond to
[EMAIL PROTECTED]

To
[EMAIL PROTECTED]
cc
Subject
XML Validation of root node





Hi,

I am trying to validate the following XML using Xerces 2.5 (also tried
with latest 2.6 version). I notice that if the root node is incorrect,
the message still gets validated successfully without any errors.
However, if any element within the document is incorrect, the XML is
reported to be invalid.

This is the original correct XML doc.

<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="cdcatalog.xsd">
                <cd>
                                 <title>Empire Burlesque</title>
                                 <artist>Bob Dylan</artist>
                                 <country>USA</country>
                                 <company>Columbia</company>
                                 <price>10.90</price>
                                 <year>1985</year>
                </cd>
</catalog>

This following XML is NOT reported by Xerces to be invalid though the
root element is incorrect.

<catalog_abc123 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="cdcatalog.xsd">
                <cd>
                                 <title>Empire Burlesque</title>
                                 <artist>Bob Dylan</artist>
                                 <country>USA</country>
                                 <company>Columbia</company>
                                 <price>10.90</price>
                                 <year>1985</year>
                </cd>
</catalog_abc123>


However, the following XML is correctly reported to be invalid.

<catalog xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="cdcatalog.xsd">
                <cd>
                                 <bad_title>Empire Burlesque</bad_title> <!-- Invalid element -->
                                 <artist>Bob Dylan</artist>
                                 <country>USA</country>
                                 <company>Columbia</company>
                                 <price>10.90</price>
                                 <year>1985</year>
                </cd>
</catalog>


The XSD (cdcatalog.xsd) is attached with this mail.

Any ideas on what could be wrong?

Thanks,
Subbu.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Attachment: cdcatalog.xsd
Description: Binary data

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to