- From: Rowan Bradley <rowan.bradley@herbertgroup.com>
- Date: Thu, 4 Jun 2009 09:51:51 +0100
- To: <xmlschema-dev@w3.org>
I'm having trouble getting my XML files to validate against my schemas using either XMLspy or LiquidXML. Sometimes one of these accepts the file and the other doesn't. The error messages are not consistent. Can someone explain how this works, or point me to a good source of this info? I have three schema files: Sensor.xsd is self-contained: <?xml version="1.0" encoding="UTF-8" ?> <xs:schema targetNamespace="http://www.herberttech.com/namespace/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.herberttech.com/namespace/" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:element name="Sensor"> ... </xs:element> <xs:element name="Range"> ... </xs:element> </xs:schema> Equipment.xsd looks like this: <?xml version="1.0" encoding="UTF-8" ?> <xsd:schema targetNamespace="http://www.herberttech.com/namespace/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://www.herberttech.com/namespace/" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xsd:include schemaLocation="Library.xsd" /> <xsd:element name="Equipment"> ... </xsd:element> </xsd:schema> The included file Library.xsd looks like this: <?xml version="1.0" encoding="UTF-8" ?> <xs:schema targetNamespace="http://www.herberttech.com/namespace/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.herberttech.com/namespace/" elementFormDefault="qualified" attributeFormDefault="unqualified"> <xs:complexType name="REMCEquipment"> Etc. The XML I'm trying to validate looks like this: <?xml version="1.0" encoding="UTF-8" ?> <Equipment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.herberttech.com/namespace/" xsi:noNamespaceSchemaLocation="Equipment.xsd" statuscode="Active"> ... </Equipment> My questions are: 1. When validating an XML file, if the schema is referred to just as a file name as above, where does the system look by default for this file? Do I need to specify a full path to this file? If so, does it need to be a URI, or a path on my local system? 2. When a schema file includes another, and just specifies the included file by its file name (as above), where does the system look by default for the included file? In the same directory as the including file? In the same directory as the XML file being validated? Somewhere else? Do I need to specify a full path to this file? If so, does it need to be a URI, or a path on my local system? 3. What does the targetNamespace attribute do? Does this have to be the same in the including and the included XSD file? What does it have to match in the XML file being validated? 4. What should I have the default (xmlns=) namespaces set to in the XML file, the including XSD file and the included XSD file? 5. These files used to validate OK when they were developed about 6 years ago. Have the rules changed, or have the tools (XMLspy and LiquidXML) got more fussy about their validation? Thanks for your help - Rowan
Received on Thursday, 4 June 2009 08:52:33 UTC