in reply to Re^3: xml parsing without using cpan modules
in thread xml parsing without using cpan modules

Of course you can parse using regular expressions. You just shouldn't grope around in a string representing an XML document using regular expressions, because you have to be certain about the context in which any match occured. That means you have to scan the string strictly front-to-back, probably using the /gc options and the \G anchor to make sure you don't miss anything. Simply picking matches out of the middle of the string is very likely to be a broken approach unless you are dealing with a known subset of XML syntax.

Makeshifts last the longest.

  • Comment on Re^4: xml parsing without using cpan modules

Replies are listed 'Best First'.
Re^5: xml parsing without using cpan modules
by iburrell (Chaplain) on Aug 10, 2004 at 19:38 UTC
    Absolutely. That regex only works because it starts at a known position (start of markup) and matches either the entire chunk or fails. It needs to see the entire document and can't work line-by-line. It is also complicated to handle the whole XML synax.
Re^5: xml parsing without using cpan modules
by Nalina (Monk) on Aug 11, 2004 at 06:29 UTC
    Could you please be bit clear?

    Thanks & Regards

    Nalina