Andrew (30)
Usenet Archive
- Joined
- Apr 5, 2007
- Messages
- 6
- Reaction score
- 0
Hi
I'm new to this group, so apologies if it's an old chestnut, or not appropriate to this group....
I have been playing around with creating xml files and schemas with which to validate them. In order to validate them, I've downloaded the "Tools for validating XML and viewing XSL output" from Microsoft and installed them. I've tried this on various machines, with various browser versions and OS's.
However, when the file is valid, right-clicking --> Validate XML reports "Validation Successful". But then introducing deliberate (and quite major) errors still results in "Validation Successful".
As an example:
staff.xml
<staff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="staff.xsd" > <person> <name>Andrew Richards</name> <dept>Training</dept> </person> </staff>
This will validate as is - even if the named xsd file doesn't exist!
But, I then create this:
staff.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="name" type="xsd:string"/> <xsd:element name="dept" type="xsd:string"/> <xsd:element name="person"> <xsd:complexType> <xsd:sequence> <xsd:element ref="name"/> <xsd:element ref="dept"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="staff"> <xsd:complexType> <xsd:sequence> <xsd:element ref="person"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>
And as expected, the xml file once again validates successfully.
But if I "break" the schema - perhaps by changing the element declaration for "dept" to "Department", it STILL validates!!!
Am I doing something wrong? Or is IE unable to validate against schemas? And if so, what's the best way of validating an XML file?
Thanks for your help
Andrew
I'm new to this group, so apologies if it's an old chestnut, or not appropriate to this group....
I have been playing around with creating xml files and schemas with which to validate them. In order to validate them, I've downloaded the "Tools for validating XML and viewing XSL output" from Microsoft and installed them. I've tried this on various machines, with various browser versions and OS's.
However, when the file is valid, right-clicking --> Validate XML reports "Validation Successful". But then introducing deliberate (and quite major) errors still results in "Validation Successful".
As an example:
staff.xml
<staff xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="staff.xsd" > <person> <name>Andrew Richards</name> <dept>Training</dept> </person> </staff>
This will validate as is - even if the named xsd file doesn't exist!
But, I then create this:
staff.xsd
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema"> <xsd:element name="name" type="xsd:string"/> <xsd:element name="dept" type="xsd:string"/> <xsd:element name="person"> <xsd:complexType> <xsd:sequence> <xsd:element ref="name"/> <xsd:element ref="dept"/> </xsd:sequence> </xsd:complexType> </xsd:element> <xsd:element name="staff"> <xsd:complexType> <xsd:sequence> <xsd:element ref="person"/> </xsd:sequence> </xsd:complexType> </xsd:element> </xsd:schema>
And as expected, the xml file once again validates successfully.
But if I "break" the schema - perhaps by changing the element declaration for "dept" to "Department", it STILL validates!!!
Am I doing something wrong? Or is IE unable to validate against schemas? And if so, what's the best way of validating an XML file?
Thanks for your help
Andrew