XML::LibXML: How to tell parse_balanced_chunk what DTD to use?

Reuben Thomas <[email protected]> Thu, 9 Sep 2010 08:40:28 +0100
Newsgroups gmane.comp.lang.perl.xml
Message-ID <[email protected]>
I am reading balanced chunks with the following code:

       my $parser = XML::LibXML->new();
       my $chunk = slurp($objpath);
       my $chunk_node;
       eval { $chunk_node = $parser->parse_balanced_chunk($chunk); };

It so happens that the XML I am trying to parse is XHTML. When it
contains an XHTML entity reference, I naturally get an undefined
entity error.

How do I tell the parser object the DTD I am using?

(Note: I imagine that if I explicitly use an HTML parser call this
would work, but there doesn't seem to be an HTML version of
parse_balanced_chunk; in any case, I would like to make this work for
arbitrary DTDs. My program can find out what DTD to use, so if I could
just pass that information on to the parser object, I will be in
business!)

--
http://rrt.sc3d.org



-- 
http://rrt.sc3d.org
_______________________________________________
Perl-XML mailing list
[email protected]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs