Validating xml with xsd schema using xerces

Y

Yona

Im trying to validate an xml file using the xercesDomParser,
but it seems like it doesnt validate the xml file.
I get an error only if the schema isnt valid.

the code is:
DOMTreeErrorReporter *errReporter = new DOMTreeErrorReporter();
parser->setErrorHandler(errReporter);

parser->setDoSchema(TRUE);
parser->setDoNamespaces(TRUE);
parser->setDoValidation(TRUE);
parser->setExternalSchemaLocation("urn:books c:\books.xsd");

parser->setValidationScheme(AbstractDOMParser::Val_Always);
parser->setValidationSchemaFullChecking(TRUE);
try{
parser->parse(pFileName);
}
catch{..}...


why doesnt it throw an error when an element has a wrong value or no closing tag??

thanx,
huku
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,150
Members
46,696
Latest member
BarbraOLog

Latest Threads

Top