Gareth, That occurred to me late last night, and was indeed my problem. However, I would have thought that xerces would throw a fatal error if the schema file it was being told to validate against did not exist. That silent failure confused me into thinking it wasn't attempting to validate at all. Is there a reason that isn't considered a fatal error (given the features I've enabled/disabled)?
Thanks for the help! Cheers, Chris Greenlee > Hi, > have you overridden the methods to report errors in your handler? > Check out SAX2Print for an example. > > Gareth > > > > On Mon, 17 Feb 2003, Chris Greenlee wrote: > >> 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] >> >> > > -- > Gareth Reakes, Head of Product Development +44-1865-203192 > DecisionSoft Limited http://www.decisionsoft.com > XML Development and Services --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]