Jason Tackaberry wrote: > On Mon, 2007-02-26 at 11:31 -0500, Jason Tackaberry wrote: >> On Mon, 2007-02-26 at 16:55 +0100, Dirk Meyer wrote: >> > IMHO cElementTree looks good. But like libxml2 it does not load the >> > dtd and it fails on all enties for epgdata.com. But a sax parser >> > should work in that case. >> >> Surely there is a way to have libxml2 parse an xml document with a >> specified DTD. > > dtd = libxml2.parseDTD(None, 'epgdata.dtd') > doc = libxml2.parseFile('epgdata.xml') > > ctxt = libxml2.newValidCtxt() > if doc.validateDtd(ctxt, dtd): > print "Document is valid" > > Untested, but maybe that works.
No, it crashes in parseFile before you make the connection between dtd and doc. I tried for a long time before giving up. Your code checks a doc against a dtd, my problem is that entities are defined in the dtd and the doc parser need to parse the dtd to get the entity definitions. Dischi -- My mind not only wanders, sometimes it leaves completely.
pgpgPM9wlYtNo.pgp
Description: PGP signature
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Freevo-devel mailing list Freevo-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/freevo-devel