Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: Update nodes in XML document

by sundialsvc4 (Abbot)
on Mar 26, 2018 at 20:55 UTC ( #1211787=note: print w/replies, xml ) Need Help??


in reply to Update nodes in XML document

I of course have no way to know just how big or how small your actual requirement may be, but I would point out that the XML industry standard, XSLT, essentially exists to allow the specification of XML transformations without writing custom-code to do it.   So, if you find that you can generalize your big-picture requirement into something that XSLT can take care of for you, it just might be an approach worth looking into.   (PerlMonks apparently won’t allow me to include a direct reference to the WikiPedia article.)

Of course I see that you are already using XML::LibXML, which leverages the venerable binary libxml2, thus giving you instant access to the definitive implementation of XSLT should it prove advantageous in this particular project.

Whether this will turn out to be “a viable approach, thanks for suggesting it,” or “overkill,” is only for you to decide.   For one-off cases it is probably overkill so, ignore this comment but if you have a lot of transformations to make it can be a very big win.   The very nice thing about Perl is that it gives you very easy access to either alternative and with the power to back it up.

Replies are listed 'Best First'.
Re^2: Update nodes in XML document
by Your Mother (Bishop) on Mar 26, 2018 at 21:16 UTC
    XSLT, essentially exists to allow the specification of XML transformations without writing custom-code

    Let's see your XSLT transform for this problem without custom code in that case. Processing instructions generally being considered code, we'll leave it as an exercise for the tethered reader as to how helpful your input is, again.

Re^2: Update nodes in XML document
by Jenda (Abbot) on Mar 27, 2018 at 12:12 UTC

    XSLT is custom code. Very unreadable and fairly restricted code.

    Jenda
    Enoch was right!
    Enjoy the last years of Rome.

Re^2: Update nodes in XML document
by AnomalousMonk (Bishop) on Mar 27, 2018 at 04:17 UTC
    ... a direct reference to the WikiPedia article.

    XSLT possibly?


    Give a man a fish:  <%-{-{-{-<

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1211787]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2019-10-16 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?