Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: XML parsing vs Regular expressions

by Cody Pendant (Prior)
on Feb 17, 2008 at 05:23 UTC ( [id://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?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2024-03-28 19:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found