The XML might not well-formed.

I can't tell you why off the top of my head, I haven't used parameter entities in a while, but if you put the xml in a separate file and if you run xmllint (the XML checker that comes with libxml2) it complains that the entity flower is not defined.

That said, when I add the proper element declarations and when I reverse the order of the 2 entity declarations, xmllint is quite happy, so it looks indeed like XML::Twig does not deal properly with parameter entities, I have to check, I haven't touched that corner of the code in years.

Actually, after looking a little deeper, it looks like it's an XML::Parser problem: when loading the external DTD, XML::Twig parses a fake document that's just the DTD and a dummy element, in order to get the entity values, otherwise XML::Parser does not read the external DTD at all.

But when I parse the document created from the DTD, either with XML::Parser or just with xmlwf (the xml checker that comes with expat), I get an "illegal parameter entity reference" error.

The document is:

<!DOCTYPE dummy [ <!ENTITY % flower_ref "daffodil"> <!ENTITY flower "%flower_ref;"> ]> <dummy/>

So this looks a bit tricky to fix. If you have any idea, I'll take it ;--(


In reply to Re: XML::Twig - resolving parameter entity decalarations by mirod
in thread XML::Twig - resolving parameter entity decalarations by jxh

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.