I'm with Dave: your best bet is to run under a debugger and look at where it crashes.
Failing that, you might want to take a look at the DOMPrint sample. On my machine, it parses and prints your sample document just fine (with -n -s -f -v=always) if all the relevant schema docs are in the same directory. This would seem to indicate some problem in your code. It's not a perfect match, since DOMPrint operates on a file input source rather than a MemBufInputSource. (Are you absolutely certain that strlen(pXMLString) is the actual size of your buffer?) -----Original Message----- From: Minh Thang Dang [mailto:[EMAIL PROTECTED] Sent: Thursday, December 13, 2007 8:39 AM To: [email protected] Subject: RE: Problem when parsing MPEG-7 metadata with schemas > At the very least, you should specify, exactly, one schema file that> shows your problem. Without a concrete test case, nobody can help you.> > Dale> The shema file is MPEG7-2001.xsd which can be downloaded at http://m7itb.nist.gov/Mpeg7-2001.xsdMy metadata file has the following content:<Mpeg7 xmlns="urn:mpeg:mpeg7:schema:2001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mpeg7="urn:mpeg:mpeg7:schema:2001" xsi:schemaLocation="urn:mpeg:mpeg7:schema:2001 Mpeg7-2001.xsd"> <DescriptionMetadata> <Version>1.0</Version> <PrivateIdentifier>descriptionUnitExample</PrivateIdentifier> </DescriptionMetadata> <DescriptionUnit xsi:type="ScalableColorType" numOfCoeff="16" numOfBitplanesDiscarded="0"> <Coeff> 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 </Coeff> </DescriptionUnit> </Mpeg7> If I don't put the mpeg7-2001.xsd in the same directory as the metadata file, my code doesn't crash the application > OK, so your application is writing to memory it doesn't own. If you run it > in the debugger, the debugger will break when the write occurs, and you can > see a stack trace. From that point, you should be able to figure out the > problem. > The problem occurs as soon as I call mpParser->parse(*memBufIS). I cannot work it out, so I posted the question here. The strangest thing is my code works well with other metadata sets (e.g. Dublin Core). Again, here is my code: XMLPlatformUtils::Initialize(); XERCES_CPP_NAMESPACE::XMLGrammarPoolImpl* GrammarPool = new XMLGrammarPoolImpl(XMLPlatformUtils::fgMemoryManager); XERCES_CPP_NAMESPACE::XercesDOMParser* parser= new XercesDOMParser(0, XMLPlatformUtils::fgMemoryManager, GrammarPool); XercesDOMParser::ValSchemes valScheme = XercesDOMParser::Val_Always; parser->setValidationScheme(valScheme); parser->setDoNamespaces(true); parser->setDoSchema(true); parser->setValidationSchemaFullChecking(true); parser->setIncludeIgnorableWhitespace(false); MemBufInputSource* memBufIS = new MemBufInputSource( (const XMLByte*)pXMLString, // pXMLString is the data to be parsed strlen(pXMLString), "FromString", false); parser->parse(*memBufIS); // CRASH here The error message is: "Unhandled exception at 0x... in foo.exe: 0xC0000005: Access violation writing location 0x...." _________________________________________________________________ Fancy some celeb spotting? https://www.celebmashup.com
