>
>  HI, I am trying to use Xerces C++ 2.2 to validate xml against an
> external schema, and this external schema may be from memory. So the input
> pamameter is an InputSource object. So I have to use
> SAX2XMLReader::loadGrammar() to load the schema ( I can't use
> SAX2XMLReader::setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,...).
> The schema does not specify "targetNamespace", and the xml file does not
> specify namespace either.  The following code can't pass validation with
> Xerces 2.2 library, but CAN pass with Xerces 2.8 library.
>
> Can anybody tell me what I can do? I can only use Xerces C++2.2 library.
>
>   SAX2XMLReader* parser = XMLReaderFactory::createXMLReader();
>
>  parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
>  parser->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
>   parser->setFeature(XMLUni::fgXercesUseCachedGrammarInParse, true);
>  DefaultHandler handler;
>  MySAX2Handler error_handler;
>
>  parser->setContentHandler(&handler);
>  parser->setErrorHandler(&error_handler);
>  parser->setEntityResolver(&handler);
>
>  parser->loadGrammar(*inputSchema*, Grammar::SchemaGrammarType, true);
>
>   parser->parse(xmlFile.c_str());
>

Reply via email to