[ 
https://issues.apache.org/jira/browse/XERCESJ-1627?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13888887#comment-13888887
 ] 

Mukul Gandhi commented on XERCESJ-1627:
---------------------------------------

I'm not sure that issue reported is a bug. But the XSD document described, 
looks like a probable use case. I've following thoughts currently about this 
issue,

1) I've a feeling that in this example, an <override> element resolves earlier 
than <import>. This is correct I think. Due to this, the kind of error 
experienced would be seen and is therefore correct.

2) We may model this schema use case, differently probably using a combination 
of <redefine>, <assert> etc.

> Invalid error when referring an attribute from another namespace in an 
> overridden schema
> ----------------------------------------------------------------------------------------
>
>                 Key: XERCESJ-1627
>                 URL: https://issues.apache.org/jira/browse/XERCESJ-1627
>             Project: Xerces2-J
>          Issue Type: Bug
>          Components: XML Schema 1.1 Structures
>    Affects Versions: 2.11.0
>            Reporter: Octavian Nadolu
>
> If I validate the "override.xsd" schema with Xerces I get an error. It seems 
> that it cannot resolve the "attr" attribute that is declared in an imported 
> schema.
> I tested on the xml-schema-1.1-dev branch. 
> ---- override.xsd------------------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
>       xmlns:imp="importNs" targetNamespace="mainNs">
>       
>       <xs:import namespace="importNs" schemaLocation="import.xsd"/>
>       
>       <xs:override schemaLocation="extended.xsd">
>               <xs:element name="mainElem">
>                       <xs:complexType>
>                               <xs:attribute ref="imp:attr"/>
>                       </xs:complexType>
>               </xs:element>
>       </xs:override>
> </xs:schema>
> --------------------------------------
> ----------- extended.xsd ----------------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:imp="importNs" 
> targetNamespace="mainNs">
>       <xs:element name="mainElem">
>               <xs:complexType>
>                       <xs:attribute name="myAttr" type="xs:Name"/>
>               </xs:complexType>
>       </xs:element>
> </xs:schema>
> ---------------------------------------------
> ------- import.xsd-----------------------
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; 
> targetNamespace="importNs">
>       <xs:attribute name="attr" type="xs:string"/>
> </xs:schema>
> --------------------------------------------
> -------- Error-------------------------------------------
> [Error] :-1:-1: src-resolve.4.2: Error resolving component 'imp:attr'. It was 
> detected that 'imp:attr' is in namespace 'importNs', but components from this 
> namespace are not referenceable from schema document 'null'. If this is the 
> incorrect namespace, perhaps the prefix of 'imp:attr' needs to be changed. If 
> this is the correct namespace, then an appropriate 'import' tag should be 
> added to 'null'.
> ---------------------------------------------------------



--
This message was sent by Atlassian JIRA
(v6.1.5#6160)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to