XML (XHTML) character entities and PxXml

Martin v. Loewis martin at v.loewis.de
Wed May 8 01:32:49 EDT 2002


andrew at acooke.org (andrew cooke) writes:

> > - include the entity definitions in the document itself, i.e. as
> >   internal entities.
> 
> please could you explain how to do that.  do i just stick a <!ENTITY
> ...> thing after the doctype?  if so, what should it include?  i can
> probably automate that.

In XML, each document has a document type, that is described in terms
of entity and attribute definitions. Some part of the document type
might be external (the "external subset"), some included in the
document (the "internal subset").

Please see

http://www.w3.org/TR/REC-xml#NT-doctypedecl

for the precise syntax of a doctypedecl; the internal subset goes as
markupdecl into the square brackets.

Please see

http://www.w3.org/TR/xhtml1/#dtds

for the definition of XHTML, in particular

http://www.w3.org/TR/xhtml1/DTD/xhtml-lat1.ent

for the definition of the latin-1 entities.

> i tried this.  at least, i tried implementing the interface and using
> a method that i thought would set the entityresolver on the parser,
> but the method on the class was never called (sorry for the lack of
> details - it was at work - i believe i used setEntityResolver and
> implemented the single method in EntityResolver as a simple "print",
> but nothing printed).

That is supposed to work; you'll need to provide details to analyse
what went wrong.

Regards,
Martin




More information about the Python-list mailing list