Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: XML element replacement

by mirod (Canon)
on Apr 21, 2006 at 16:18 UTC ( #544942=note: print w/replies, xml ) Need Help??


in reply to XML element replacement

It might be good enough for a quick and dirty utility at work, but I don't think it makes much sense to post it here.

Your code doesn't even begin to cover the XML spec, and you don't list any of its obvious limitations (no attributes allowed in replaced tags, no CDATA support...).

--
The XML Police

Replies are listed 'Best First'.
Re^2: XML element replacement
by Anonymous Monk on Apr 29, 2006 at 04:52 UTC
    Curious - the poster started out by saying that he had a really hard time installing libXML or somesuch. I just tried an install of XML::Simple, and guess what? unresolved prerequisites, no good.

    I hear the most XML libraries are out of control. Java-itis, bulky, over-engineered, to difficult interfaces. I haven't tried the Perl version, but hey, guess I won't be trying XML::Simple tonight, either.

    I have a need for a simple XML parse myself. A known set of tags, the same every time. Treating it like text may be an adequately grungy thing to do. It looks to me like the guy has some training, and isn't that great at Perl. Hey, like me! I like this guy.

    I never did like police.

      I have no problem with people who know what they are doing using regexps on consenting XML, within the privacy of their own job. If they really know what they are doing, all will be well. If they don't, then they've brought it upon themselves, they have to deal with it. I just have problems with people posting that kind of code, as it will lead people who really don't know what they're doing to think that this is a proper way to deal with XML. This would be indecent exposure if I may push the analogy a little too far ;--)

      BTW, if you can't install libxml2 (on which XML::LibXML is based), then try an expat based module, preferably XML::Twig of course ;--) On Windows, XML::Parser comes pre-installed with Activestate Perl. On any sensible platform that includes a compiler, both expat and libxml2 should install easily. XML libraries are generally not over-engineered, it's just that most custom code is under-engineered, not dealing with XML but for a very limited, and usually un-specified subset of XML (no comments, no nested tags, no mixed content are common limitations).

      And if you didn't like my tongue-in-cheek police reference, how about calling my original answer a "consumer report" advice to recall the original code, would that fare better with you?

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (4)
As of 2022-01-20 14:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (56 votes). Check out past polls.

    Notices?