Sponsored Content
Full Discussion: parse xml
Top Forums Programming parse xml Post 48103 by DreamWarrior on Thursday 26th of February 2004 01:46:17 PM
Old 02-26-2004
You could always write your own Smilie I did, in about 2600 lines of code. But I had no choice, I needed something that no other library wanted to give me, the ability to parse chunks of XML and piece them together into a final parse tree structure. That was plenty of fun...doesn't completed support the XML definition (doesn't support document type definition) but it works for simple stuff....
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to parse a XML file using PERL and XML::DOm

I need to know the way. I have got parsing down some nodes. But I was unable to get the child node perfectly. If you have code please send it. It will be very useful for me. (0 Replies)
Discussion started by: girigopal
0 Replies

2. Shell Programming and Scripting

How can I parse xml file?

How can I parse file containing xml ? I am sure that its best to use perl - but my perl is not very good - can someone help? Example below contents of file containing the xml - I basically want to parse the file and have each field contained in a variable.. ie. I want to store the account... (14 Replies)
Discussion started by: frustrated1
14 Replies

3. Shell Programming and Scripting

Parse an XML task list to create each task.xml file

I have an task definition listing xml file that contains a list of tasks such as <TASKLIST <TASK definition="Completion date" id="Taskname1" Some other <CODE name="Code12" <Parameter pname="Dog" input="5.6" units="feet" etc /Parameter> <Parameter... (3 Replies)
Discussion started by: MissI
3 Replies

4. Shell Programming and Scripting

Parse XML

Hi all! I'm looking to write a quick script and in it I need to request an XML file from a service running on localhost and parse that XML file and output it. I'm looking to do it in bash although it doesn't really matter what shell it is in. The XML file returned would look like this: ... (3 Replies)
Discussion started by: mtehonica
3 Replies

5. Shell Programming and Scripting

Parse XML line

Hi I am having an xml file with lines like these <d name="T2tt_350_100" title="T2tt_012j_350_100_428p4_pPF_PU" add="1" color="4" ls="1" lw="2" normf="1" xsection="0.070152" EqLumi="94651.6"... (2 Replies)
Discussion started by: Alkass
2 Replies

6. UNIX for Dummies Questions & Answers

Parse xml file

HI Guys, Input .XML <xn:MeContext id="L0307"> <xn:ManagedElement id="1"> <xn:VsDataContainer id="1"> <xn:attributes> <xn:vsDataType>vsDataENodeBFunction</xn:vsDataType> ... (3 Replies)
Discussion started by: pareshkp
3 Replies

7. Shell Programming and Scripting

Parse XML File.

HI Guys I have Below XML File : <xn:SubNetwork id="XYZ"> <xn:SubNetwork id="C01"> <xn:MeContext id="CO1"> <xn:ManagedElement id="1"> <un:RncFunction id="1"> <un:UtranCell id="NY431"> ... (2 Replies)
Discussion started by: pareshkp
2 Replies

8. Shell Programming and Scripting

Parse XML using xmllint

Hi All, Need help to parse the xml file in shell script using xmllint. Below is the sample xml file. <CARS> <AUDI> <Speed="45"/> <speed="55"/> <speed="75"/> <speed="95"/> </AUDI> <BMW> <Speed="30"/> <speed="75"/> <speed="120"/> <speed="135"/> </BMW>... (6 Replies)
Discussion started by: prasanna2166
6 Replies

9. Shell Programming and Scripting

Parse xml file

I am trying to create a shell script that will parse an xml file (file attached). awk '/Id v=/ { print }' Test.xml | sed 's!<Id v=\"\(.*\)\"/>!\1!' > output.txt An output.txt file is created but it is empty. It should contain the value 222159 in it. Thanks. (7 Replies)
Discussion started by: cmccabe
7 Replies

10. Shell Programming and Scripting

Parse XML For Values

Hi All, I want to parse XML to extract values of the tags to do further processing. The XML looks like <?xml version="1.0" encoding="ISO-8859-1"?> <allinput> <input A="2389906" B="install"> <C>111</C> <D>222</D> <E>333</E> <F></F> <G>444</G> <H></H> <I></I> <J></J> <K>C,D,E,G</K>... (6 Replies)
Discussion started by: rahulmittal87
6 Replies
XML::TreeBuilder(3)					User Contributed Perl Documentation				       XML::TreeBuilder(3)

NAME
XML::TreeBuilder - Parser that builds a tree of XML::Element objects SYNOPSIS
foreach my $file_name (@ARGV) { my $tree = XML::TreeBuilder->new({ 'NoExpand' => 0, 'ErrorContext' => 0 }); # empty tree $tree->parse_file($file_name); print "Hey, here's a dump of the parse tree of $file_name: "; $tree->dump; # a method we inherit from XML::Element print "And here it is, bizarrely rerendered as XML: ", $tree->as_XML, " "; # Now that we're done with it, we must destroy it. $tree = $tree->delete; } DESCRIPTION
This module uses XML::Parser to make XML document trees constructed of XML::Element objects (and XML::Element is a subclass of HTML::Element adapted for XML). XML::TreeBuilder is meant particularly for people who are used to the HTML::TreeBuilder / HTML::Element interface to document trees, and who don't want to learn some other document interface like XML::Twig or XML::DOM. The way to use this class is to: 1. start a new (empty) XML::TreeBuilder object. 2. set any of the "store" options you want. 3. then parse the document from a source by calling "$x->parsefile(...)" or "$x->parse(...)" (See XML::Parser docs for the options that these two methods take) 4. do whatever you need to do with the syntax tree, presumably involving traversing it looking for some bit of information in it, 5. and finally, when you're done with the tree, call $tree->delete to erase the contents of the tree from memory. This kind of thing usually isn't necessary with most Perl objects, but it's necessary for TreeBuilder objects. See HTML::Element for a more verbose explanation of why this is the case. METHODS AND ATTRIBUTES
XML::TreeBuilder is a subclass of XML::Element, which in turn is a subclass of HTML:Element. You should read and understand the documentation for those two modules. An XML::TreeBuilder object is just a special XML::Element object that allows you to call these additional methods: $root = XML::TreeBuilder->new() Construct a new XML::TreeBuilder object. Parameters: NoExpand Passed to XML::Parser. Do not Expand external entities. Deafult: undef ErrorContext Passed to XML::Parser. Number of context lines to generate on errors. Deafult: undef $root->eof Deletes parser object. $root->parse(...options...) Uses XML::Parser's "parse" method to parse XML from the source(s?) specified by the options. See XML::Parse $root->parsefile(...options...) Uses XML::Parser's "parsefile" method to parse XML from the source(s?) specified by the options. See XML::Parse $root->parse_file(...options...) Simply an alias for "parsefile". $root->store_comments(value) This determines whether TreeBuilder will normally store comments found while parsing content into $root. Currently, this is off by default. $root->store_declarations(value) This determines whether TreeBuilder will normally store markup declarations found while parsing content into $root. Currently, this is off by default. $root->store_pis(value) This determines whether TreeBuilder will normally store processing instructions found while parsing content into $root. Currently, this is off (false) by default. $root->store_cdata(value) This determines whether TreeBuilder will normally store CDATA sectitons found while parsing content into $root. Adds a ~cdata node. Currently, this is off (false) by default. SEE ALSO
XML::Parser, XML::Element, HTML::TreeBuilder, HTML::DOMbo. And for alternate XML document interfaces, XML::DOM and XML::Twig. COPYRIGHT AND DISCLAIMERS
Copyright (c) 2000,2004 Sean M. Burke. All rights reserved. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This program is distributed in the hope that it will be useful, but without any warranty; without even the implied warranty of merchantability or fitness for a particular purpose. AUTHOR
Current Author: Jeff Fearn <jfearn@cpan.org>. Former Authors: Sean M. Burke, <sburke@cpan.org> perl v5.16.3 2014-06-09 XML::TreeBuilder(3)
All times are GMT -4. The time now is 03:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy