Greetings!
I'm attempting to validate a very small XML document against a very small
schema, without specifying it internally. Here's my code:
-------begin-------
MyHandler handler;
SAX2XMLReader* reader = XMLReaderFactory::createXMLReader();
XMLCh *propertyValue = XMLString::transcode("myschema.xsd");
ArrayJanitor<XMLCh> propertyValueJanitor(propertyValue);
std::auto_ptr<SAX2XMLReader> safeReader(reader);
safeReader->setFeature(XMLUni::fgSAX2CoreNameSpaces, true);
safeReader->setFeature(XMLUni::fgXercesSchemaFullChecking, true);
safeReader->setFeature(XMLUni::fgSAX2CoreNameSpacePrefixes, true);
safeReader->setFeature(XMLUni::fgXercesSchema, true);
safeReader->setFeature(XMLUni::fgSAX2CoreValidation, true);
safeReader->setFeature(XMLUni::fgXercesDynamic, false);
safeReader->setProperty(XMLUni::fgXercesSchemaExternalNoNameSpaceSchemaLocation,
propertyValue);
safeReader->setContentHandler(&handler);
safeReader->setErrorHandler(&handler);
safeReader->parse("myxml.xml");
-------end-------
This doesn't work at all; no validation occurs as far as I can tell. In
fact, I can delete the XSD file without any errors showing up. I can
mangle the XML file horribly and it doesn't care (with or without an XSD
sitting there). The XML file is definitely being parsed. What am I doing
wrong?
Cheers,
Chris Greenlee
[EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]