Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses

Re: XML parsing vs Regular expressions

by Cody Pendant (Prior)
on Feb 17, 2008 at 05:23 UTC ( #668388=note: print w/replies, xml ) Need Help??

in reply to XML parsing vs Regular expressions

The reasons are the same as for HTML parsing really. Your regular expression will do what you want it to do, probably, and then you'll come to trust it and it will come back to bite you when you meet an unexpected case.

Does it:

  • ignore code which is commented out?
  • allow for attribute order changing?
  • cope with the characters < and > appearing inside attributes, or CDATA sections?
There are probably a hundred more things you'd have to think of to make your regular expression solution bullet-proof, by which time you might as well have written your own XML parser.

Nobody says perl looks like line-noise any more
kids today don't know what line-noise IS ...

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2020-07-02 17:24 GMT
Find Nodes?
    Voting Booth?

    No recent polls found