in reply to (tye)Re: Picking the best way....
in thread Picking the best way....
I am not disagreeing with your recommendation to use moderation. That is an excellent idea. I am just advocating _extreme_caution ;--)
Especially when dealing with XML, which is a deceiptively simple format.
You can certainly use regexps to write a throw-away hack, which is going to be used only once, on very well known XML data, ideally generated by code you have also written yourself. That's about it! And it doesn't happen that often.
Using regexps on any thing else means that sooner or later you will come accross something that's completely legal XML, but that completely breaks your code. And believe me, if it is legal XML (and most likely even if it is not) it is bound to pop up in your data. You can hava a look at On XML Parsing for just a quick list of what can go wrong.
A last word: if you are dealing with something that is nearly (...) XML, do yourself a favor: use 2 steps: First get from the nearly-thingie to the real stuff, and then use an XML module. It would be even better if you could refuse the data alltogether because it is not valid!
|
---|