Xerces c validating xml parser

Unfortunately i haven't found a way to do this with Xerces C , yet. Boris Kolpackov suggests in a blog post that applications should provide the XSD schema files by themselves rather than looking up the schema files through the xsi:schema Location or xsi:no Namespace Schema Location attributes found in the XML file.In the blog post there is a link to (Adapted somewhat from https://stackoverflow.com/a/15829424/757777 but untested) Included in the software Code Synthesis XSD the embedded example (that is put in the public domain) demonstrates how to use xercesc:: Bin Input Stream and xercesc:: XMLGrammar Pool::deserialize Grammars to load a precompiled XSD schema. Try implementing the methods in it to print errors to the console.I'm writing a library which takes xml files and parses them. I have a scheme and want to use it to to validate an XML file.I've define the xsd file and an error handler, but for some reason the xsd is not throwing errors. What do you mean when you say you are not seeing errors? If that is your expectation then this will not happen because you have set the Error Handler as below.

but f Error Reporter is null, so nothing is reported. UPDATE: This is Xerces-c version 3.1 Note I've read this but it doesn't seem to work with SAX.However, when I initially look at each xml file, I do not know what file it is until I parse it, hence I cannot link a static xsd file to it.Is there a way of saying, I want to validate each xml file against xsd1 or xsd2 or etc...Theoretically an user could just open this file and mess around with it.That's why i would like my xsd to be hardcoded in my library.

Leave a Reply