DOCTYPE in XML

Martin von Loewis loewis at informatik.hu-berlin.de
Tue Jun 5 04:18:22 EDT 2001


vdanovich at empireone.net (Vyacheslav Danovich) writes:

> <!DOCTYPE smtp
> [
>   <!ENTITY successful_run SYSTEM "d:\python21\success.xml">
>   <!ENTITY faulty_run SYSTEM "d:\PYTHON21\fault.xml">
> ]>
[...]
> 	doc = Sax2.FromXmlFile(file, validate=0)
[...]
> At the end the values for "text" were the empty string ("")
> It seems like the parser doesn't parse the DOCTYPE entities

Indeed it doesn't. Only a validating parser is guaranteed to process
external entities, so you should set validate to 1 here. That will
make you use xmlproc, which does read the external entities.

Regards,
Martin




More information about the Python-list mailing list