in reply to Re: Re: Preferred Methods (again)
in thread Preferred Methods (again)

Get off your high horse about XML compliance. He gave a sample input format and asked how to grab pieces of it. If he changes the input format or wants it to handle broken input, he has to change the way he parses. That's true with an XML parser too.

Replies are listed 'Best First'.
Re: Re: Re: Re: Preferred Methods (again)
by Juerd (Abbot) on Jan 17, 2002 at 01:38 UTC
    seattlejohn already commented on xml compliance.

    With an XML parser you don't have to change your parsing for grabbing the root element when the input changes, with a regex you (probably) do.

    2;0 juerd@ouranos:~$ perl -e'undef christmas' Segmentation fault 2;139 juerd@ouranos:~$

      With an XML parser you don't have to change your parsing for grabbing the root element when the input changes

      Not when the content changes, but when the format changes you do. You example was a format change: <root><foo/><root><bar/></root></root> <!-- Yes, your regex will take the second <root> --> If that's even legal, it would certainly require changes in your code to get the right part.