in reply to XML::Parser::Expat Question
I believe that XML::Parser normal behavior is to use the internal subset (in the document itself), but to ignore the external subset (anything defined in the DTD).
XML::LibXML might give you more flexibility. If all you want to do is replace those entities, you might be able to do it by just using the appropriate option with xmllint, which comes with libxml2.
And of course XML::Twig will let you do this ;--)
#!/usr/bin/perl -w use strict; use XML::Twig; XML::Twig->new( expand_external_ents => 1, pretty_print => 'indented') ->parsefile( "test_ext_ent.xml") ->print;
Note that in the current version of XML::Twig (3.15) entities used in attribute values will silently disappear (XML::Parser is not very cooperative there either). This is fixed in the development version that's... on my laptop. Let me know if you need it and I will upload it to the XML::Twig page.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: XML::Parser::Expat Question
by dobrozam (Initiate) on Aug 18, 2004 at 22:27 UTC | |
by mirod (Canon) on Aug 18, 2004 at 22:46 UTC | |
by dobrozam (Initiate) on Aug 18, 2004 at 23:06 UTC |