I have an xml document with a doctype pointing to a dtd in the same folder: <!DOCTYPE point SYSTEM "point.dtd"> <point> <address>abc</address> </point> I parse it, and check out the dtd's root = etree.parse(open('point_dtd.xml')) intdtd = root.docinfo.internalDTD # lxml.etree.DTD object extdtd = root.docinfo.externalDTD # None I was expecting externalDTD to return a DTD for the point.dtd schema, and the internalDTD to be None. Furthermore intdtd is "empty", for instance intdtd.elements returns an empty list, while point.dtd does in fact define elements! Shouldn't externalDTD point to dtd for the point.dtd?
Thomas Larsen Wessel, 26.09.2012 18:13:
I have an xml document with a doctype pointing to a dtd in the same folder:
<!DOCTYPE point SYSTEM "point.dtd"> <point> <address>abc</address> </point>
I parse it, and check out the dtd's
root = etree.parse(open('point_dtd.xml')) intdtd = root.docinfo.internalDTD # lxml.etree.DTD object extdtd = root.docinfo.externalDTD # None
I was expecting externalDTD to return a DTD for the point.dtd schema, and the internalDTD to be None.
Furthermore intdtd is "empty", for instance intdtd.elements returns an empty list, while point.dtd does in fact define elements!
Shouldn't externalDTD point to dtd for the point.dtd?
Only if you load the DTD. http://lxml.de/parsing.html#parser-options Stefan
Please let me know if my question does not make sense or if I need to elaborate smth. I thought my question would be very easy to answer, since I am very new to this, so I am a bit surprised that I have not heard anything yet :) On Wed, Sep 26, 2012 at 6:13 PM, Thomas Larsen Wessel <mrvelle@gmail.com>wrote:
I have an xml document with a doctype pointing to a dtd in the same folder:
<!DOCTYPE point SYSTEM "point.dtd"> <point> <address>abc</address> </point>
I parse it, and check out the dtd's
root = etree.parse(open('point_dtd.xml')) intdtd = root.docinfo.internalDTD # lxml.etree.DTD object extdtd = root.docinfo.externalDTD # None
I was expecting externalDTD to return a DTD for the point.dtd schema, and the internalDTD to be None.
Furthermore intdtd is "empty", for instance intdtd.elements returns an empty list, while point.dtd does in fact define elements!
Shouldn't externalDTD point to dtd for the point.dtd?
Thomas Larsen Wessel, 28.09.2012 09:33:
Please let me know if my question does not make sense or if I need to elaborate smth. I thought my question would be very easy to answer, since I am very new to this, so I am a bit surprised that I have not heard anything yet :)
http://thread.gmane.org/gmane.comp.python.lxml.devel/6567/focus=6568 Oh, and please don't top-post in replies. Stefan
participants (2)
-
Stefan Behnel -
Thomas Larsen Wessel