Altova Mailing List Archives>Archive Index >microsoft.public.xml Archive Home >Recent entries >Thread Prev - Resolving entities using MSXML [Thread Next] Re: Resolving entities using MSXMLTo: NULL Date: 5/16/2009 4:21:00 PM mikeidge@g... wrote: > I'm trying to parse an XML document using MSXML v4 in C++, using my > own entity resolver to re-direct the parser at local DTDs on my own > hard-drive, rather than allowing the parser to go online to get the > DTDs from their locations as specified in the XML file being parsed. > I've managed to get this working with Xerces, but the behaviour I'm > experiencing in MSXML seems somewhat bizarre. > > The XML document I'm reading is completely valid, so I don't expect > any errors to be reported by the parser. Indeed, this is the case if I > let the parser go online to get the DTD files by leaving the pvarInput > VARIANT pointer NULL in the resolveEntity(...) callback. However, as > soon as I try to supply the parser with the text of the identical DTDs/ > MODs sourced from my local disk, I get the following error: "incorrect > document syntax", which, apparently, occurs on the first line of the > XML file. This doesn't happen for all of the DTD files though; in the > case I'm trying to debug, the first DTD it asks for works with no > problems, but I get the error as soon as it tries to use the second > MOD file it asks for. Are you sure that it's the first line of the file that it causing the error, and not the resolution value you have supplied for the file? In other words, is the "incorrect document syntax" error referring to the file from which the call is made to the DTD or module, or to the syntax of the DTD or module itself? It may be worth supplying your local file values in URI format (required by XML), eg file://c:/folder/subfolder/file.mod rather than just the bare folder-and-filename. It might also be worth avoiding or escaping spaces and other oddities in folder and file names. If this shows that it is the first line causing the problem, what is that first line? DTDs and module files should not normally start with an XML Declaration, and should certainly never start with a Document Type Declaration (two gotchas often ignored by software used to generate DTDs and modules). Ultimately, extract your document and all its associated local copies of DTDs and modules into a separate folder, edit them to reference each other correctly, and run an independent standalone validating parser over them (eg onsgmls, rxp, etc). This will show up any internal inconsistencies which may be being hidden by the other layers of application software. Having proved that the standalone (ie offline) document set is valid, you may be better placed to locate the problem in the software. ///Peter -- XML FAQ: http://xml.silmaril.ie/ | ||||||
| Company | Legal | Press | Partners | Careers | Sitemap | Contact Us | Altova Blog | Mobile | Full Site | |||
|
