W3C home > Mailing lists > Public > xmlschema-dev@w3.org > January 2003

validation with a grammar

From: Miguel Siu <msiu@sdsio-mail.jpl.nasa.gov>
Date: Fri, 10 Jan 2003 10:55:44 -0800
To: <xmlschema-dev@w3.org>
Cc: "Miguel Siu" <msiu@sdsio-mail.jpl.nasa.gov>
Message-ID: <NCBBKAKKFJCDPIHCEAOGEEOLDKAA.msiu@sdsio.jpl.nasa.gov>

Hi, I have been trying to validate an XML document
with a schema grammar that I pre-parse before parsing
the main document.  My schema grammar parses successfully,
but I've not been able to apply it to the parsing of the
target XML document.  Help!  I am using the XercesDOMParser
APIs as follows:


    XercesDOMParser *parser = new XercesDOMParser;

    parser->setValidationScheme(XercesDOMParser::Val_Always);
    parser->setDoNamespaces(true);
    parser->setDoSchema(true);
    parser->setValidationSchemaFullChecking(true);
    parser->setCreateEntityReferenceNodes(true);
    .
    .
    .
          // Loading grammar from xsd file
          //
          const char*                xsdptr = "grammar.xsd" ;
          const short                grammartype = 1 ;  //DTD or Schema
          parser->cacheGrammarFromParse(true);
          parser->loadGrammar(xsdptr, grammartype, true);
     .
     .
     .          
          parser->useCachedGrammarInParse(true);   //redundant
          parser->parse(XmlFile);


NOTES:
I have used the isUsingCachedGrammarInParse()  
and also the    isCachingGrammarFromParse()  APIs to verify
that the grammar is being parsed and cached.  I just can't get it
to be applied to my XmlFile parse!  Thanks for the help.




----------------------------------------------------------------------
"I am putting myself to the fullest possible use, which is all I can
think that any conscious entity can ever hope to do."

                         -- from 2001, A Space Odyssey.
----------------------------------------------------------------------
| Miguel Siu                                msiu@sdsio.jpl.nasa.gov  |
| RAYTHEON Corporation                                               |
| 299 North Euclid Ave. Suite 500           (626) 817-5923  Raytheon |
| Pasadena, CA  91101                                                |
+--------------------------------------------------------------------+
Received on Friday, 10 January 2003 13:57:27 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Tuesday, 11 January 2011 00:14:35 GMT