Sponsored Content
Top Forums Shell Programming and Scripting Help in parsing XML output file in perl. Post 302745641 by jim mcnamara on Monday 17th of December 2012 05:17:20 PM
Old 12-17-2012
You are better off using XML::Parser - search.cpan.org
to parse xml.

It is somewhat complex, but it will handle correctly formed XML strings.
What if for some valid reason some "field" you expect to key off of is missing? grep may break. An xml parser won't.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

HTTP Query Request & Parsing returned XML output

I have a PERL script from which I need to make a HTTP request to Web Servlet (Essentially a URL with variables and values like &Variable1=AAAAAA&Variable2=BBBBBBBBB&Variable3=CCCCCCC). The Web servlet returns an XML result which needs to be parsed for the contents of the result within the program.... (15 Replies)
Discussion started by: jerardfjay
15 Replies

2. UNIX for Advanced & Expert Users

xml parsing error in perl

******************PERL VERSION************************ This is perl, v5.8.1 built for i386-linux-thread-multi ERROR!!!!---Undefined subroutine &main::start called at /usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi/XML/Parser/Expat.pm line 469. *********************PERL... (1 Reply)
Discussion started by: bishweshwar
1 Replies

3. UNIX for Dummies Questions & Answers

Help parsing a XML file ....

Well I have read several threads on the subject ... but being a newbie like me makes it hard to understand ... What I need is the following: Input data: ------- snip --------- <FavouriteLocations> <FavouriteLocations class="FavouriteList"><Item... (6 Replies)
Discussion started by: misak
6 Replies

4. Shell Programming and Scripting

Random XML Parsing - using Perl

Given the XML: <?xml version="1.0" encoding="UTF-8"?> <reference> <refbody> <section> <p> <ul> <li><xref href="file1.dita#anchor" /></li> <li><xref href="file2.dita#anchor" /></li> </ul> </p> </section> <section> <p> <xref href="file3.dita#anchor" /> </p> <p> <xref... (4 Replies)
Discussion started by: ricksj
4 Replies

5. Shell Programming and Scripting

Bash XML Parsing using Perl XPath

I have a bash script that needs to read input from an XML file, which includes varying numbers of a certain type of child node. I want to be able to iterate through all the child nodes of a given parent. I installed the Perl XML-XPath package from search.cpan.org. Once it's installed, from bash,... (4 Replies)
Discussion started by: jfmorales
4 Replies

6. Shell Programming and Scripting

parsing xml file

Hello! We need to parse weblogic config.xml file and display rows in format: machine:listen-port:name:application_name In our enviroment the output should be (one line for every instance): Crm-Test-Web:8001:PIA:peoplesoft Crm-Test-Web:8011:PIA:peoplesoft... (9 Replies)
Discussion started by: annar
9 Replies

7. Shell Programming and Scripting

parsing XML result by using perl?

for some reasons, i need to parse the XML result by using perl. for instance, this is a sample XML result: <Response> <status>success</status> <answer>AAA::AAA</answer> <answer>BBB::BBB</answer> </Response> then i can use this way : my @output = (); foreach my $parts (@all) ##@all... (2 Replies)
Discussion started by: tiger2000
2 Replies

8. Shell Programming and Scripting

XML: parsing of the Google contacts XML file

I am trying to parse the XML Google contact file using tools like xmllint and I even dived into the XSL Style Sheets using xsltproc but I get nowhere. I can not supply any sample file as it contains private data but you can download your own contacts using this script: #!/bin/sh # imports... (9 Replies)
Discussion started by: ripat
9 Replies

9. UNIX for Dummies Questions & Answers

Parsing XML file

I want to parse xml file sample file....... <name locale="en">my_name<>/name><lastChanged>somedate</lastChanged><some more code here> <name locale="en">tablename1<>/name><lastChanged>somedate</lastChanged> <definition><dbquery><sources><sql type="cognos">select * from... (10 Replies)
Discussion started by: ms2001
10 Replies

10. Shell Programming and Scripting

Help with parsing xml file

Hi, Need help with parsing xml data in unix and place it in a csv file. My xml file looks like this: <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <iwgroups> <nextid value="128"> </nextid> <iwgroup name="RXapproval" id="124" display-name="RXapproval"... (11 Replies)
Discussion started by: ajayakunuri
11 Replies
RPC::XML::Parser::XMLParser(3pm)			User Contributed Perl Documentation			  RPC::XML::Parser::XMLParser(3pm)

NAME
RPC::XML::Parser::XMLParser - A container class for XML::Parser SYNOPSIS
# This class should rarely (if ever) be used directly: use RPC::XML::ParserFactory 'XML::Parser'; ... $P = RPC::XML::ParserFactory->new(); $P->parse($message); DESCRIPTION
This class implements the interface defined in the RPC::XML::Parser factory-class (see RPC::XML::Parser) using the XML::Parser module to handle the actual manipulation of XML. SUBROUTINES
/METHODS This module implements the public-facing methods as described in RPC::XML::Parser: new [ ARGS ] The constructor only recognizes the two parameters specified in the base class (for the RPC::XML::base64 file-spooling operations). parse [ STRING | STREAM ] The parse() method accepts either a string of XML, a filehandle of some sort, or no argument at all. In the latter case, the return value is a parser instance that acts as a push-parser (a non-blocking parser). For the first two types of input, the return value is either a message object (one of RPC::XML::request or RPC::XML::response) or an error. parse_more STRING (Only callable on a push-parser instance) Parses the chunk of XML, which does not have to describe a complete document, and adds it to the current running document. If this method is called on a parser instance that is not a push-parser, an exception is thrown. parse_done (Only callable on a push-parser instance) Finishes the parsing process and returns either a message object (one of RPC::XML::request or RPC::XML::response) or an error (if the document was incomplete, not well-formed, or not valid). If this method is called on a parser instance that is not a push-parser, an exception is thrown. DIAGNOSTICS
All methods return some type of reference on success. The new and parse methods return message strings on errors. The parse_more and parse_done methods may throw exceptions on errors, if the error occurs at the XML::Parser level. EXTERNAL ENTITIES
As of version 1.24 of this module (version 0.75 of the RPC::XML suite), external entities whose URI is a "file:/" scheme (local file) are explicitly ignored. This is for security purposes. BUGS
Please report any bugs or feature requests to "bug-rpc-xml at rt.cpan.org", or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RPC-XML <http://rt.cpan.org/NoAuth/ReportBug.html?Queue=RPC-XML>. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes. SUPPORT
o RT: CPAN's request tracker http://rt.cpan.org/NoAuth/Bugs.html?Dist=RPC-XML <http://rt.cpan.org/NoAuth/Bugs.html?Dist=RPC-XML> o AnnoCPAN: Annotated CPAN documentation http://annocpan.org/dist/RPC-XML <http://annocpan.org/dist/RPC-XML> o CPAN Ratings http://cpanratings.perl.org/d/RPC-XML <http://cpanratings.perl.org/d/RPC-XML> o Search CPAN http://search.cpan.org/dist/RPC-XML <http://search.cpan.org/dist/RPC-XML> o MetaCPAN https://metacpan.org/release/RPC-XML <https://metacpan.org/release/RPC-XML> o Source code on GitHub http://github.com/rjray/rpc-xml <http://github.com/rjray/rpc-xml> LICENSE AND COPYRIGHT
This file and the code within are copyright (c) 2011 by Randy J. Ray. Copying and distribution are permitted under the terms of the Artistic License 2.0 (http://www.opensource.org/licenses/artistic-license-2.0.php <http://www.opensource.org/licenses/artistic-license-2.0.php>) or the GNU LGPL 2.1 (http://www.opensource.org/licenses/lgpl-2.1.php <http://www.opensource.org/licenses/lgpl-2.1.php>). CREDITS
The XML-RPC standard is Copyright (c) 1998-2001, UserLand Software, Inc. See <http://www.xmlrpc.com> for more information about the XML- RPC specification. SEE ALSO
RPC::XML, RPC::XML::Parser, XML::Parser AUTHOR
Randy J. Ray <rjray@blackperl.com> perl v5.14.2 2011-07-23 RPC::XML::Parser::XMLParser(3pm)
All times are GMT -4. The time now is 03:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy