Hello, The XML Schema 1.1 test suite (on w3.org site) specifies the following schema test.
[1] <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <!-- xsi:noNamespaceSchemaLocation can be made mandatory --> <xs:element name="root"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:decimal"> <xs:attribute ref="xsi:noNamespaceSchemaLocation" use="required"/> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:schema> The test says that the above schema should be valid. But Xerces-J 2.11.0 reports the above schema as invalid and following error is produced by Xerces, when I attempt to do a schema validation test: complex010.xsd:10:82:src-resolve.4.2: Error resolving component 'xsi:noNamespaceSchemaLocation'. It was detected that 'xsi:noNamespaceSchemaLocation' is in namespace 'http://www.w3.org/2001/XMLSchema-instance', but components from this namespace are not referenceable from schema document 'complex010.xsd'. If this is the incorrect namespace, perhaps the prefix of 'xsi:noNamespaceSchemaLocation' needs to be changed. If this is the correct namespace, then an appropriate 'import' tag should beadded to 'complex010.xsd'. complex010.xsd:10:82:src-resolve: Cannot resolve the name 'xsi:noNamespaceSchemaLocation' to a(n) 'attribute declaration' component. Here are few questions and thoughts: 1. Does Xerces looks non compliant according to this test? 2. Xerces doesn't allow an attribute declaration whose targetNamespace is http://www.w3.org/2001/XMLSchema-instance. So it seems we can't do currently for example with Xerces, [2] <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="http://www.w3.org/2001/XMLSchema-instance"> <xs:attribute name="noNamespaceSchemaLocation" type="xs:anyURI" /> </xs:schema> and import this schema in the test suite schema [1] to solve this use-case. Do we have a schema somewhere on web (perhaps on www.w3.org site), from where we can import the definitions of namespace http://www.w3.org/2001/XMLSchema-instance instead of users writing a schema like [2] to provide these definitions themselves? 3. Interestingly the following schema using XML Schema 1.1 assertions seem to solve the problem for this use case, <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <!-- xsi:noNamespaceSchemaLocation can be made mandatory --> <xs:element name="root"> <xs:complexType> <xs:simpleContent> <xs:extension base="xs:decimal"> <xs:assert test="@xsi:noNamespaceSchemaLocation" /> </xs:extension> </xs:simpleContent> </xs:complexType> </xs:element> </xs:schema> Any thoughts please. -- Regards, Mukul Gandhi --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
