I'm trying to write a data loader for integration tests for Google's Big Table. 
 I've written the schema.  I figured it would be a good idea to use the grammar 
pool feature to speed things up.  How can I stop Xerces from using the network 
(my guess is it's validating my schema)?  I'm using most of the code from the 
sample for the grammar builder.  I tried changing features from true to false 
but it's still going out to the network; there must be some magic combination 
I've missed.

Here's my code:

   public void buildGrammar(final String schemaPath) throws Exception {
       final SymbolTable sym = new SymbolTable(XmlGrammarBuilder.BIG_PRIME);
       final XMLGrammarPoolImpl grammarPool = new XMLGrammarPoolImpl();

       final XMLGrammarPreparser preparser = new XMLGrammarPreparser(sym);

       preparser.registerPreparser(XMLGrammarDescription.XML_SCHEMA, null);

       preparser.setProperty(XmlGrammarBuilder.GRAMMAR_POOL, grammarPool);

       preparser.setFeature(XmlFeatures.NAMESPACES.uri(), true);
       preparser.setFeature(XmlFeatures.VALIDATION.uri(), true);

       preparser.setFeature(XmlFeatures.VALIDATION_SCHEMA.uri(), true);
       preparser.setFeature(XmlFeatures.SCHEMA_FULL_CHECKING.uri(), true);
       preparser.setFeature(XmlFeatures.HONOUR_ALL_SCHEMA_LOCATIONS.uri(),
               true);
       preparser.setFeature(XmlFeatures.STANDARD_URI_CONFORMANT.uri(), true);

       preparser.preparseGrammar(XMLGrammarDescription.XML_SCHEMA,
               new XMLInputSource(null, schemaPath, null));

       final XMLParserConfiguration parserConfiguration =
               new XIncludeAwareParserConfiguration(sym, grammarPool);

       parserConfiguration.setFeature(XmlFeatures.NAMESPACES.uri(), true);
       parserConfiguration.setFeature(XmlFeatures.VALIDATION.uri(), true);

       parserConfiguration.setFeature(XmlFeatures.VALIDATION_SCHEMA.uri(),
               true);
       parserConfiguration.setFeature(XmlFeatures.SCHEMA_FULL_CHECKING.uri(),
               true);
       parserConfiguration.setFeature(XmlFeatures.HONOUR_ALL_SCHEMA_LOCATIONS
               .uri(), true);
       parserConfiguration.setFeature(XmlFeatures.STANDARD_URI_CONFORMANT
               .uri(), true);

       parserConfiguration.parse(new XMLInputSource(null, schemaPath, null));

       this.parser = new SAXParser(parserConfiguration);
   }

Thanks

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscr...@xerces.apache.org
For additional commands, e-mail: j-users-h...@xerces.apache.org

Reply via email to