[ 
https://issues.apache.org/jira/browse/XERCESC-1728?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12517296
 ] 

Alberto Massari commented on XERCESC-1728:
------------------------------------------

Scott,
the issue you are referring is a different one, and it's a bug 
(setExternalSchemaLocation should take the precedence on the xsi:schemaLocation 
attribute). In this case the namespace "ns2" is associated with the first 
schema, and "ns1" with the second one; when the second schema tries to import 
the third one as namespace "ns2", Xerces ignores the hint because it already 
saw it, and use the first schema only (hence, the 'missing type' error). I used 
the term "strict" because of this statement in the specs:

Note: The above (paragraph 4.2.3 , Schema Representation Constraint: Import 
Constraints and Semantics) is carefully worded so that multiple <import>ing of 
the same schema document will not constitute a violation of clause 2 of Schema 
Properties Correct (3.15.6), but applications are allowed, indeed encouraged, 
to avoid <import>ing the same schema document more than once to forestall the 
necessity of establishing identity component by component. Given that the 
schemaLocation [attribute] is only a hint, it is open to applications to ignore 
all but the first <import> for a given namespace,

Xerces takes the road of "applications are encouraged to avoid importing the 
same schema document more than once" and "applications can ignore all but the 
first import for a given namespace".

Alberto


> Element defined in the imported schema file can not be correctly referred to
> ----------------------------------------------------------------------------
>
>                 Key: XERCESC-1728
>                 URL: https://issues.apache.org/jira/browse/XERCESC-1728
>             Project: Xerces-C++
>          Issue Type: Bug
>          Components: Validating Parser (Schema) (Xerces 1.5 or up only)
>    Affects Versions: 2.7.0
>         Environment: Windows XP
>            Reporter: Bill Yan
>
> There are there schema files in the following:
> testelemref.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns="ns2" 
> xmlns:nm1="ns1" targetNamespace="ns2" elementFormDefault="qualified" 
> attributeFormDefault="unqualified">
>       <xs:import namespace="ns1" schemaLocation="testelemref1.xsd"/>
>       <xs:element name="elem3">
>               <xs:complexType>
>                       <xs:sequence>
>                               <xs:element ref="nm1:elem1"/>
>                       </xs:sequence>
>               </xs:complexType>
>       </xs:element>
> </xs:schema>
> testelemref1.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:n0="ns1" 
> xmlns:n1="ns2" targetNamespace="ns1" elementFormDefault="qualified" 
> attributeFormDefault="unqualified">
>       <xs:import namespace="ns2" schemaLocation="testelemref2.xsd"/> 
>       <xs:element name="elem1">
>               <xs:complexType>
>                       <xs:sequence>
>                               <xs:element ref="n0:elem2" minOccurs="0"/>
>                               <xs:element ref="n1:elem4" minOccurs="0"/>
>                       </xs:sequence>
>               </xs:complexType>
>       </xs:element>
>       <xs:element name="elem2" type="xs:string"/>
> </xs:schema>
> testelemref2.xsd:
> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; targetNamespace="ns2" 
> elementFormDefault="qualified" attributeFormDefault="unqualified" 
> xmlns:nm1="ns2">
>       <xs:element name="elem4" type="xs:string"/>
> </xs:schema>
> When I use XercesDOMParser::loadGrammar() to check the validity of 
> testelemref.xsd, the following error is reported:
> "Type not found in ns2:elem4 - Line 8, Col 47"
> but when I use XMLSpy to check, it's valid, no error is found.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to