Hi,
I am having problems converting from the DOM parser to the SAX2 parser.
I have code that will parse an xml file, using a schema, without error for
DOM.
When I try to parse the same xml file, using the same scheme with SAX2, the
parser reports errors.
Here is the code to configure the DOM and SAX2 parsers. What am I doing wrong
for SAX2?
FYI, the my_DefaultHandler is currently an empty wrapper around the
DefaultHandler class.
--DOM
parser->setCreateEntityReferenceNodes(false);
parser->setExpandEntityReferences(true);
if (!schemaFile.empty()) {
parser->setDoNamespaces(true);
parser->setDoSchema(true);
parser->setValidationScheme(XercesDOMParser::Val_Always);
parser->setIncludeIgnorableWhitespace(false);
parser->setCreateCommentNodes(false);
parser->setExternalNoNamespaceSchemaLocation(schemaFile.c_str());
}
--SAX2
if (!schemaFile.empty()) {
parser->setFeature(XMLUni::fgSAX2CoreValidation, true);
parser->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
parser->setFeature(XMLUni::fgXercesSchema, true);
parser->setFeature(XMLUni::fgXercesSchemaFullChecking, false);
parser->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,
reinterpret_cast<void*>(const_cast<char*>(schemaFile.c_str())));
}
parser->setErrorHandler(const_cast<my_DefaultHander*>(contentHandler));
parser->setContentHandler(const_cast<my_DefaultHander*>(contentHandler));
thanks
---------------------------------
Do you Yahoo!?
Next-gen email? Have it all with the all-new Yahoo! Mail Beta.