[Expat-discuss] Parsing External Entities
Karl Waclawek
karl at waclawek.net
Wed Jan 15 09:11:51 EST 2003
----- Original Message -----
From: "Michael B. Allen" <miallen at eskimo.com>
To: <expat-discuss at libexpat.org>
Sent: Wednesday, January 15, 2003 2:44 AM
> Now this may be my ignorace of XML but when I run this through my
> dump program which just regurgitates XML the ExternalEntityRefHandler
> runs OK and as you can see from the dialog below it completed parsing
> the DOCTYPE definition however it is not resolving the internal entity
> 'E'. If I remove 'SYSTEM "err.dtd"' the entity is resolved properly and
> the program completes successfully. Why does this happen?
>
> <?xml version="1.0"?>
> <?DOCTYPE staff SYSTEM "err.dtd" [
> <!ENTITY E "This is a general entity">
> <!ELEMENT employeeId (#PCDATA)>
> ]><err>
> expatdump.c:270:parse: An XML parser error occured: line 6 col 15 off 40: undefined entity:
> eneral entity"> ]> <err> The entity is: &E; </err>
> ^
> expatdump.c:352:expatdump:
> expatdump.c:380:main: Failure
This should work.
You should provide more detail about how you are setting up
and calling Expat. Reduce it to a short code example and post it.
>
> Also, using the external entity XML_Parser created with
> XML_ExternalEntityParserCreate my dump program segfaults if I attempt
> to free it with XML_ParserFree. I suppose this parser is simply the same
> parser in a different state and therefore I need not free it?
No, you must free it. Need more detail.
Which version of Expat are you using?
Karl
More information about the Expat-discuss
mailing list