I agree theoretically, my only problem is that practically I did not find a way to do it.

The problem is applying a regexp (or regexp-like) expression to a series of tag to wrap them. It looks like I have to face one of 2 nasty problems: either I rewrite the XML parsing process or I rewrite the regexp engine! Not being Ilya the choice was easy ;--)

I don't think that either XPath or XSLT would let me define a _range_ of elements to be wrapped with the same flexibility the regexp engine gives me. I think XPointer is supposed to include ranges, but I don't know how flexible it will be, and I don't know of any Perl module that supports it.

The problem seems to be just outside of the specs of most existing tools or standards.


In reply to Re: Re: Ugly XML processing looking for a pure XML solution by mirod
in thread Ugly XML processing looking for a pure XML solution by mirod

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.