Home. 
.

transparent

transparent

transparent

Altova Mailing List Archives


Re: Resolving entities using MSXML

From: Peter Flynn <peter.nosp@-.--------.-->
To: 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/


transparent
Print
Mail
Like It
Disclaimer
.

These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.

.
.

transparent

transparent