Justin Robinson wrote:

Thanks Chris,

I'll take a look there. Do you know if Xerces actually tries to access
namespaces/schemas from off the net?

Not a namespace; a namespace is just a string and can't be 'accessed'. But it will get a schema off the net if it has a location on the net. Wouldn't work otherwise.


I'm wondering if, initially, my pool is
missing a grammar and on the first parse it's actually caching the grammar
I've missed.

Sounds likely. You can set a breakpoint in retrieveGrammar() to see if you get called for a schema you aren't expecting.


Bob Foster


Justin

----- Original Message ----- From: "Christopher Ebert" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, January 06, 2005 8:41 PM
Subject: RE: Problem caching grammars




Just a guess here, but since it's the first parse, I'd suspect
configurePipeline() or some other initialization step. You might look at
the configuration mechanism and see if there's a way to streamline it;
this would probably mean looking at the way the configuration is
determined and setting parameters for the first pathway that's checked
so it gets the configuration you want.

HTH

Chris

-----Original Message-----
From: Justin Robinson [mailto:[EMAIL PROTECTED]
Sent: Thursday, January 06, 2005 12:34
To: [EMAIL PROTECTED]
Subject: Re: Problem caching grammars

Any thoughts on this?

----- Original Message -----
From: "Justin Robinson" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, January 02, 2005 2:34 PM
Subject: Problem caching grammars



Hi there....

I have managed to preparse my XML Schema and have put it in a grammar

pool,

according to the active caching approach descrbied at
http://xml.apache.org/xerces2-j/faq-grammars.html#faq-1

I'm expecting the time taken to set up my SAX parser to increase,

which it

does, so that's fine.
I'm also expecting the time taken on the first parse call to decrease.

This is where my problem is. The first parse still takes an average of

about

7 times longer than subsequent parses.

What else must I do to bring down the time taken for the first parse??

I tried to look at the source code, but I'm having trouble locating

where

the time might be taken up (still learning how to debug). The path of
execution goes through these classes:

1. AbstractSAXParser
2. XMLParser
3. XML11Configuration (methods parse() and configurePipeline())

Any ideas?

Here's how I set up the grammar pool:

  private XMLGrammarPool getGrammarPool() throws IOException {
     // create grammar preparser

     XMLGrammarPreparser preparser = new XMLGrammarPreparser();

     // register a specialized default pre-parser
     preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA,

null);

     // create grammar pool
     XMLGrammarPool grammarPool = new XMLGrammarPoolImpl();

     // set the grammar pool on the grammar preparser
     // so that all the compiled grammars are automatically
     // placed to the grammar pool



preparser.setProperty("http://apache.org/xml/properties/internal/grammar -poo

l", grammarPool);

     // parse grammar(s). They are automatically added to the pool,
beacause of the above
     // property that has been set.
     preparser.setFeature("http://xml.org/sax/features/namespaces";,

true);

preparser.setFeature("http://xml.org/sax/features/validation";,

true);


preparser.setFeature("http://apache.org/xml/features/validation/schema";,

true);



preparser.setFeature("http://apache.org/xml/features/validation/schema-f ull-

checking", true);

     Grammar g = preparser.preparseGrammar(
         XMLGrammarDescription.XML_SCHEMA, new XMLInputSource(null,



"c:\\jdev\\workspace\\UncleJustWiki\\xmlschemas\\DraftRevisionSchema.xsd ",

               null));

     // lock grammar pool. Don't add any more grammars
     grammarPool.lockPool();
     return grammarPool;
  }

Regards,
Justin



---------------------------------------------------------------------
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]




--------------------------------------------------------------------- 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]



Reply via email to