Re: XML parser



Tomi Holger Engdahl said the following on 28/02/2006 12:01:
"Joshua Morgan" <joshua.morgan@xxxxxxxxx> writes:

A general XML parser, and that is actually what I was considering
doing, using regular expression to pull out the data and put it into a
nice array that can be used by some functions.

You can find examples of reading XML files using three different techniques (including that regular expression method) at this article:

Reading and writing the XML DOM with PHP
Using the DOM library, SAX parser and regular expressions
http://www-128.ibm.com/developerworks/xml/library/os-xmldomphp/?ca=dgr-lnxw06XML-PHP


And as that article says, use of regular expressions to "parse" XML is a bad idea unless you're absolutely sure that the XML string/file is well-formed and valid.


--
Oli
.



Relevant Pages

  • Re: More Regexp and file load problems
    ... I have a regular expression problem I can't seem to figure my way out ... xml. ... #!/usr/bin/env ruby ... puts "#" ...
    (comp.lang.ruby)
  • Re: RegEx
    ... rest of the page will or that it will contain well-formed HTML. ... but i need some assistance on what the regular expression ... > it in as XML and then parse it to get the values. ...
    (microsoft.public.dotnet.general)
  • Re: XML parser
    ... nice array that can be used by some functions. ... You can find examples of reading XML files using three different ... techniques (including that regular expression method) at this ... Reading and writing the XML DOM with PHP ...
    (comp.lang.php)
  • Re: quick and easy way to parse XML
    ... > are, generally speaking, not powerful enough to parse XML! ... Parsing XML requires a stack (or more precisely, ... some of the available regular expression packages contain ...
    (comp.lang.java.help)
  • Re: Python regex question
    ... I'm trying to create a regular expression for matching some particular XML strings. ... I want to extract the contents of a particular XML tag, only if it follows one tag, but not follows another tag. ...
    (comp.lang.python)