[Expat-discuss] undefined entity - how can i fix it ?
Karl Waclawek
karl at waclawek.net
Mon Nov 15 18:07:09 CET 2004
> 2. When will expat use the DTD file ? How can I pass the DTD file to expat ?
To pass the DTD file you need to write an ExternalEntityRefhandler.
The handler gets the system and public identifiers passed and has
to load the corresponding file and use an instance of an Expat parser
(created with XML_ExternalEntityParserCreate()) to parse the external
file - using the same kind of parsing loop you would use for the document.
The xmlwf application included with the Expat distribution uses
most of the Expat API, so it is useful to study it.
> 1. After calling XML_UseForeignDTD(...), the special characters is removed.
> They will not appear in parameter of my handlers.
Under certain conditions it is legal to skip a reference to an undeclared entity.
Btw, when turning on the UseForeignDTD flag, and the document does not have
a Doctype declaration, then the ExternalEntityRefhandler will be called
with both systemid and publicid NULL.
Karl
----- Original Message -----
From: "Golibasku" <ceo at absoft-net.com>
To: <expat-discuss at libexpat.org>
Sent: Monday, November 15, 2004 11:49 AM
Subject: Re: [Expat-discuss] undefined entity - how can i fix it ?
> After reading the reference.html many times, I still don;t know how to use
> the DTD file. I have the following problems.
> 1. After calling XML_UseForeignDTD(...), the special characters is removed.
> They will not appear in parameter of my handlers.
> 2. When will expat use the DTD file ? How can I pass the DTD file to expat ?
>
> ----- Original Message -----
> From: "Karl Waclawek" <karl at waclawek.net>
> To: "Golibasku" <ceo at absoft-net.com>; <expat-discuss at libexpat.org>
> Sent: Monday, November 15, 2004 1:54 PM
> Subject: Re: [Expat-discuss] undefined entity - how can i fix it ?
>
>
> > To add to the preceding discussion: I did a little googling, and found
> > that there is a DTD for RSS defined - search for "RSS DTD 0.91".
> >
> > Strictly speaking, your document should have a Doctype declaration
> > pointing to that DTD. Since it does not, you can still apply the DTD
> > (one you have downloaded it) to that document by using the
> > XML_UseForeignDTD() API in Expat, which is documented in reference.html.
> >
> > Karl
> >
> > ----- Original Message -----
> > From: "Golibasku" <ceo at absoft-net.com>
> > To: <expat-discuss at libexpat.org>
> > Sent: Monday, November 15, 2004 12:30 AM
> > Subject: Re: [Expat-discuss] undefined entity - how can i fix it ?
> >
> >
> >> Are you sure ? all the RSS in the Internet don't have DTD declared in the
> >> xml file (internal / external). But all the xml parser (of course the
> >> parser don't have critical bugs) can parse them without error. I think
> >> well-formed XML document doesn't need to have a DTD. A "VALID" XML
> >> document need to have DTD.
> >>
> >> But anyway, I am not a student or teacher. I am not teaching XML 101.
> >> That's why I don't want to argue on the definition problem. I only need
> >> to write a program to parse the xml file. Is there any example in expat
> >> which show how to parse such XML document.?
> >>
> >>
> >> ----- Original Message -----
> >> From: "Karl Waclawek" <karl at waclawek.net>
> >> To: "Golibasku" <ceo at absoft-net.com>; <expat-discuss at libexpat.org>
> >> Sent: Monday, November 15, 2004 1:12 PM
> >> Subject: Re: [Expat-discuss] undefined entity - how can i fix it ?
> >>
> >>
> >>> If your file does not have a DTD then obviously it is missing
> >>> the entity declaration and is therefore not well-formed.
> >>> This means - strictly speaking - it does not conform
> >>> to the definition of an XML document, and no conforming
> >>> parser will accept it.
> >>>
> >>> ----- Original Message -----
> >>> From: "Golibasku" <ceo at absoft-net.com>
> >>> To: <expat-discuss at libexpat.org>
> >>> Sent: Sunday, November 14, 2004 11:13 PM
> >>> Subject: Re: [Expat-discuss] undefined entity - how can i fix it ?
> >>>
> >>>
> >>>> Can you give me more information ? My XML don't have any DTD, i just
> >>>> want to use expat to get the content from it.
> >>>>
> >>>>> Did you declare this entity in the DTD?
> >>>>> If not, that is what you need to do, since in XML there are only
> >>>>> very few predefined entities.
> >>>>>
> >>>>> ----- Original Message -----
> >>>>> Subject: [Expat-discuss] undefined entity - how can i fix it ?
> >>>>>
> >>>>> Dear all,
> >>>>> in my xml document, there is a line which contains "©" - no
> >>>>> quote. Expat told me "undefined entity at line ...". It is the
> >>>>> copyright symbol. How can i parse the document successfully ?
> >>>>
> >>>> _______________________________________________
> >>>> Expat-discuss mailing list
> >>>> Expat-discuss at libexpat.org
> >>>> http://mail.libexpat.org/mailman/listinfo/expat-discuss
> >>>>
> >>>
> >>
> >> _______________________________________________
> >> Expat-discuss mailing list
> >> Expat-discuss at libexpat.org
> >> http://mail.libexpat.org/mailman/listinfo/expat-discuss
> >>
> >
>
> _______________________________________________
> Expat-discuss mailing list
> Expat-discuss at libexpat.org
> http://mail.libexpat.org/mailman/listinfo/expat-discuss
>
More information about the Expat-discuss
mailing list