in reply to Ugly XML processing looking for a pure XML solution

If your input document is indeed XML (and hey, I was gonna do the same trick with MIF, so let me know if this indeed works), then you should be able to construct something with XSLT or XML::XPath to do the trick. Or just construct a DOM object, and hack at it. That'd be better than reconstructing all the argument processing stuff directly in Perl, methinks.

-- Randal L. Schwartz, Perl hacker

  • Comment on Re: Ugly XML processing looking for a pure XML solution

Replies are listed 'Best First'.
Re: Re: Ugly XML processing looking for a pure XML solution
by mirod (Canon) on Dec 14, 2000 at 19:56 UTC

    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.