in reply to Re: XML parsing
in thread XML parsing

Thanks to all of you. I really like the solution of putting the cmd output to a scalar variable and also to an array after converting it by join.

I carefully analysed the output of the cmd that contains as follows:

first line: 'Starting webservices call'

second line: blank

third line: <?xml version="1.0"?>

followed by the entire xml doc.

I wonder how much would it be reliable to discard the first two lines, if this changes in future. Can I use .. and ... to extract between "<?xml version" and the last tag. Need some expert advice considering the reliability.

Many thanks

Sudip

Replies are listed 'Best First'.
Re^3: XML parsing
by ikegami (Patriarch) on Sep 22, 2008 at 06:03 UTC
    use XML::Simple; .. my $outputInfo = qx[$cmd]; $outputInfo =~ s/^.*?(?=<\?xml)//s; my $ref = XMLin($outputInfo));
      Please let me know what the regex is doing in the example given. While trying this I got the following:

      not well-formed (invalid token) at line 624, column 71, byte 30538 at c:/perl/lib/XML/Parser.pm line 187

      regards

      Sudip

        It deletes up to but not including "<?xml"