Hi All, 

I have the attached simple schemas a, b, and c, in
which a import b, and b import c, a and c have the
same target namespace, but b have a different target
namespace.

I tried to loadGrammar using schema a like this:

    SAXParser*          parser = new SAXParser;
    actaHandlers*       handler = new actaHandlers(); 

    parser->setValidationScheme(SAXParser::Val_Never);
    parser->setDoNamespaces(true);
    parser->setDoSchema(true);

    parser->setErrorHandler(handler);
//  parser->setEntityResolver(handler);
    parser->setDocumentHandler(handler);

    try
    {
        parser->loadGrammar(input,
Grammar::SchemaGrammarType);
}
    catch (const XMLException& e)
    {
          ......
    }
  
I always get the type not found error for a type
defined in schema. 

However, if I use schema b as the root, I don't have a
problem. And I debugged the Xerces code, seems like in
preprocessImport (in traverseSchema.cpp), when try to
resolve schema c, because it have the same target
namespace as a, and it thinks grammar already found,
so stop loading types from schema c.

I tried to use my own entityResolver as well as the
default one.

Is this a bug in Xerces or I need to set up my parser
differently?

Thanks much.
Frank 

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns="http://www.xyz.org/XYZ"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:ABC="http://www.xyz.org/ABC"; targetNamespace="http://www.xyz.org/XYZ"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:import namespace="http://www.xyz.org/ABC"; schemaLocation="b.xsd"/>
	<xs:element name="E1">
	    <xs:complexType>
	       <xs:sequence>
		   <xs:element name="E3" type="e3Type"/>
	       </xs:sequence>
	   </xs:complexType>
	</xs:element>
</xs:schema>
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:ABC="http://www.xyz.org/ABC"; xmlns:XYZ="http://www.xyz.org/XYZ"; xmlns="http://www.xyz.org/ABC"; targetNamespace="http://www.xyz.org/ABC"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:import namespace="http://www.xyz.org/XYZ"; schemaLocation="c.xsd"/>
	<xs:element name="E2" type="XYZ:e2Type">
	</xs:element>
</xs:schema>
<?xml version="1.0" encoding="utf-8"?>
<xs:schema xmlns="http://www.xyz.org/XYZ"; xmlns:xs="http://www.w3.org/2001/XMLSchema"; xmlns:ABC="http://www.xyz.org/ABC"; targetNamespace="http://www.xyz.org/XYZ"; elementFormDefault="qualified" attributeFormDefault="unqualified">
	<xs:simpleType name="e2Type">
		<xs:restriction base="xs:int"/>
	</xs:simpleType>
	<xs:simpleType name="e3Type">
		<xs:restriction base="xs:string"/>
	</xs:simpleType>
</xs:schema>

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

Reply via email to