You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by "Octavian Nadolu (JIRA)" <xe...@xml.apache.org> on 2012/12/19 10:43:13 UTC

[jira] [Created] (XERCESJ-1599) Prefix not resolved corectly when overriding an element

Octavian Nadolu created XERCESJ-1599:
----------------------------------------

             Summary: Prefix not resolved corectly when overriding an element
                 Key: XERCESJ-1599
                 URL: https://issues.apache.org/jira/browse/XERCESJ-1599
             Project: Xerces2-J
          Issue Type: Bug
          Components: XML Schema 1.1 Structures
    Affects Versions: 2.11.0
            Reporter: Octavian Nadolu


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>
---------------------------------------------

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

---------------------------------------------------------------------
To unsubscribe, e-mail: j-dev-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-dev-help@xerces.apache.org