[
https://issues.apache.org/jira/browse/XERCESJ-1599?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13536039#comment-13536039
]
Mukul Gandhi commented on XERCESJ-1599:
---------------------------------------
There seems to be a workaround to this issue as follows,
Instead of having xmlns:ns="schemaNS" within schema.xsd on the <schema>
element, if you write this namespace declaration at
<xs:element ref="ns:link" xmlns:ns="schemaNS"/>
or perhaps,
<xs:override schemaLocation="override.xsd">
<xs:element name="person" xmlns:ns="schemaNS">
Then it works.
> 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: [email protected]
For additional commands, e-mail: [email protected]