Hi, the code is actually more than this and I've made a mistake when cutting down an example. So no, I do define and use the same.

Thanks for pointing out the use of parse_param_ent ! Now it works as it should, and access to ENTITY variables is easy. Yes, it ought to be found in the XML::Twig docs.

I've noticed that seemingly it cannot be used along with keep_encoding. In my case, that's fine and I won't bother with using both.

On the other hand, the actual DOCTYPE declaration is not handled at all. I have to remove it (eg. sed it out) from the XML files. That could be a normal thing to do in a way since it directs to an external network resource. I'm not a XML expert.

The following:

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE sect1 PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" [ <!ENTITY % component-entities SYSTEM "components.ent"> %component-entities; ]>

Yields the following error:

cannot expand > - cannot load 'http://www.oasis-open.org/docbook/xml/4 +.5/docbookx.dtd' at /usr/lib64/perl5/site_perl/5.8.8/x86_64-linux-thr +ead-multi/XML/Parser/Expat.pm line 469

Whereas the following is all OK:

<?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE sect1 [ <!ENTITY % component-entities SYSTEM "components.ent"> %component-entities; ]>

Thanks.


In reply to Re^2: XML::Twig and ENTITY declarations by carcassonne
in thread XML::Twig and ENTITY declarations by carcassonne

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.