[Expat-discuss] Manage unknown entityes?
Bjorn Brox
brox at corena.no
Thu Mar 6 08:30:23 EST 2003
How can I manage unknown entities?
When parsing the following xml file I get the error: "undefined entity
at line 7" and the parser stops.
--------------------
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE doc [
<!ELEMENT doc ANY>
<!ELEMENT para (#PCDATA)>
]>
<doc>
<para>Hello World¿</para>
</doc>
--------------------
The ¿ entity is one of the standard SGML character entities
defined in ISOPub, but unknown by the expat parser.
I know that I could solve this by adding an entity declaration, but very
often users asssume that a parser have a knowledge about all the ISO
defined entities.
Is it possible to set up a callback where I can handle unknown entities
where I can deside myself if I want the parser to terminate or simply
return the correct UTF-8 code if my callback know the entity?
--
Bjorn Brox, CORENA Norge AS, http://www.corena.no/, ICQ 17872043
Industritunet, Dyrmyrgt. 35, N-3611 Kongsberg, NORWAY
Phone: +47 32717210, Fax: +47 32717201, Mobile: +47 92638590
More information about the Expat-discuss
mailing list