Dale Worley wrote:
On Fri, 2007-09-14 at 20:24 +0200, Boris Kolpackov wrote:
    // Initialize the schema cache.
    //
    parser->loadGrammar ("library.xsd", Grammar::SchemaGrammarType, true);
    parser->setFeature (XMLUni::fgXercesUseCachedGrammarInParse, true);

What precisely is it that tells the parser that the XML is described by
"library.xsd" even though there is no namespace reference in the XML
itself?  The setFeature call appears to do that, but there must be some
implicit requirement that there be only one cached grammar at that
moment, otherwise how would the parser know which grammar to apply?
Only one grammar per namespace URI, not one grammar. The parser uses the namespace URI of the root element to locate a grammar. The namespace URI string is a key into a hash table of grammar objects.

Dave

Reply via email to