Venu,
When I attempt to parse the an instance document of an uncached grammar
using the SAXParser, I am unable to pick up fixed optional attributes using
passive caching. However, when I actively preparse the grammar, I am able
to pick up the optional attributes that are resident in my schema(xsd)
files. Besides the parsing takes place significantly faster, telling me
that the schemas are not being referenced.
To preparse the grammar I was the code from the XMLGrammarBuilder sample.
The sample uses the XMLGrammarPreparser class as follows..
thanks in advance,
Ismail
XMLGrammarPreparser preparser = new XMLGrammarPreparser(sym);
preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null);
preparser.setProperty(GRAMMAR_POOL, grammarPool);
preparser.setFeature(NAMESPACES_FEATURE_ID, true);
preparser.setFeature(VALIDATION_FEATURE_ID, false);
preparser.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
Grammar g = preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA,
stringToXIS(fileName));
"K. Venugopal"
<[EMAIL PROTECTED] To: [EMAIL PROTECTED]
com> cc:
Subject: Re: Passive caching of
grammars
07/08/2003 11:09
PM
Please respond to
xerces-j-user
Hi Ismail ,
What exactly is the problem you are facing , what makes you say that
passive caching is not working ?
Regards,
venu
Ismail Nalwala wrote:
>
>
>Hi,
>I am trying to use xni to cache xml schema grammars. The xerces
>documentation mentions that active and passive caching of schemas are both
>possible, as long as there is an an instance of the XMLGrammarPool object
>associated with the parser. The sample code and documentation describes
how
>to preparse schema grammars to acheive active caching and preventing
>unwanted grammars from entering the grammar pool. However I am unable to
>get passive caching to work. I do not want to pre-detrmine all the
grammars
>that I may need, however I still want to maintain a cache of all the
>grammars that are needed by my application.
>I have tried doing the following with no luck. Any thoughts or guidance
>will be greatly appreciated.
>
>thanks
>Ismail.
>
> SymbolTable sym = new SymbolTable(BIG_PRIME);
>
> XMLGrammarPoolImpl grammarPool = new XMLGrammarPoolImpl();
> grammarPool.unlockPool();
> XMLGrammarCachingConfiguration parserConfiguration = new
>XMLGrammarCachingConfiguration (sym, grammarPool);
> parserConfiguration.unlockGrammarPool();
> parserConfiguration.setFeature(NAMESPACES_FEATURE_ID, true);
> parserConfiguration.setFeature(VALIDATION_FEATURE_ID, false);
> parserConfiguration.setFeature(SCHEMA_VALIDATION_FEATURE_ID, true);
> parserConfiguration.setProperty(GRAMMAR_POOL,grammarPool);
>
> XMLReader reader = new SAXParser(parserConfiguration);
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]