Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
2.11.0
-
None
Description
If I validate the following schema "schema.xsd" I get an error:
"s4s-att-invalid-value: Invalid attribute value for 'ref' in element 'element'. Recorded reason: UndeclaredPrefix: Cannot resolve 'ns:link' as a QName: the prefix 'ns' is not declared."
The prefix "ns" is declared correctly in the "schema.xsd" schema, so there should be no error reported. It seems that the validation context is not set correctly, it uses the namespace declaration from the "override.xsd" schema instead of "schema.xsd". If I declare the "ns" prefix in the "override.xsd" schema there is no error.
You can reproduce the issue on the xml-schema-1.1-dev branch.
----------- schema.xsd-----------------------
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="schemaNS" xmlns:ns="schemaNS">
<xs:override schemaLocation="override.xsd">
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="name"/>
<xs:element name="email"/>
<xs:element ref="ns:link"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:override>
<xs:element name="link"/>
</xs:schema>
-------------------------------------------
---------------override.xsd----------
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" targetNamespace="schemaNS">
<xs:element name="person">
<xs:complexType>
<xs:sequence>
<xs:element name="name"/>
<xs:element name="email"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>
---------------------------------------------