Hi All,
 
I got a few questions regarding schema paring in Xerces:
 
(1) I created a parser and load grammar like this:
       
            SAX2XMLReader* pParser = XMLReaderFactory::createXMLReader();
        pParser->loadGrammar(theSchema, Grammar::SchemaGrammarType);
 
    Now can I start traversing the schema without calling the parse(...) method on the pParser? I would like to create my own representation of the schema, so I need to fully traverse the schema starting from a root element.
 
(2) Also, in order to select a root element, Is there a way to get a list of all global elements under a certain namespace if the schema import schemas that have different target namespaces?
 
(3) A specific question regarding import statement. If I have two statements like this in a schema:
 
        <xsd:import namespace="ns1" schemaLocation="schemaA.xsd"> 
        <xsd:import namespace="ns2" schemaLocation="schemaB.xsd"> 
 
    But schemaA.xsd refers to elements and types in schemaB, is this supposed to work? I use Xerces-C 2.7 and I got type not found error. If I switch the two import statements, then it works fine.
 
    I also notice that the same thing using include statement, that is, the following won't work if schemaA.xsd refers something in schemaB.xsd:
 
        <xsd:import namespace="ns1" schemaLocation="schemaA.xsd"> 
        <xsd:include schemaLocation="schemaB.xsd"> 
 
    But this will work:
 
        <xsd:include schemaLocation="schemaB.xsd"> 
        <xsd:import namespace="ns1" schemaLocation="schemaA.xsd"> 
 
    But isn't it true that the import elements must appear as the first children of the schema element?
 
 
Thanks much in advance.
Frank
 

Reply via email to