Sponsored Content
Top Forums Shell Programming and Scripting Looping through XML file on basis of a node Post 302943706 by clx on Tuesday 12th of May 2015 05:19:01 AM
Old 05-12-2015
Welcome to the forum. You need an xml parsing tool. more precisely xpath handling. You can google for it.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

shell call xalan to transform xml with xslt, but can not find root node

hi experts: i am using xslt to transform xml in shell. But can not find root node of source xml, if i remove the naming space definition in source xml, it works fine. So our the question is how to let xslt know the naming space of srouce xml file? Thanks for your kindly help in... (0 Replies)
Discussion started by: summer_cherry
0 Replies

2. Shell Programming and Scripting

How to get value from xml node using sed/perl/script?

hello, new to this forum. but i have a requirement to extract the value from multiple xml node and print out the values to new file with comma seperated. would like to know how this would be done using either sed/perl or some unix script. an example would be tremendous... sample input file:... (2 Replies)
Discussion started by: davidsouk
2 Replies

3. Shell Programming and Scripting

Split one file to Multiple file with report basis in unix

Hi, Please help on this. i want split the below file(11020111.CLT) to more files with some condition. :b: 1) %s stating of the report 2) %e ending of the report example starting of the report: %sAEGONCA| |MUMBAI | :EXPC|N|D ending of the report %eAEGONCA| |MUMBAI | :EXPC 3)so the... (10 Replies)
Discussion started by: krbala1985
10 Replies

4. Shell Programming and Scripting

How to get the main node name in xml using perl?

Hi, I am having an conf file like this: <Main> <NODE> <NODENAME>FRUITS</NODENAME> <NAME>APPLE</NAME> <COLOUR>RED</COLOUR> <NODE> <IsWrapper/> <NODENAME>SEASONAL</NODENAME> <NODE> <NAME>MANGO</NAME> <COLOUR>GREEN</COLOUR> </NODE> </NODE>... (4 Replies)
Discussion started by: vanitham
4 Replies

5. Shell Programming and Scripting

Find Node and replace line(s) preceding in xml file

Hello, I have an xml file whose contacts are like below: <Node>Apple <B>Value1</B> <B>Value2</B> <B>Value3</B> </Node> <Node>Mango <B>Value1</B> <B>Value2</B> <B>Value3</B> </Node> <Node>Apple <B>Value1</B> <B>Value2</B> <B>Value3</B> </Node> <Node>Bannana (3 Replies)
Discussion started by: umarsatti
3 Replies

6. Shell Programming and Scripting

Separate a file on the basis of timestamp

hi, I have a log file which contains data for last 7 seven days. I want to copy all the data for 6 days in one file and keep only the data for today in that log file and mail that log file containing today's data. Log file is in this format Time: 120529 10:51:08 User@Host: local @ ... (4 Replies)
Discussion started by: arijitsaha
4 Replies

7. UNIX for Dummies Questions & Answers

Iterate/Loop Through XML Node List

I need to load an XML file and loop through a list of nodes in it to execute a shell script for each one using the attributes for each node as parameters for the script. Any ideas? Any help will be much appreciated. (1 Reply)
Discussion started by: bradlecat
1 Replies

8. Homework & Coursework Questions

Accessing one UNIX node from another node of the same server

Hi Experts, I am in need of running a script from one node say node 1 via node 2. My scheduling tool dont have access to node2 , so i need to invoke the list file from node1 but the script needs to run from node2. because the server to which i am hitting, is having access only for the node... (5 Replies)
Discussion started by: arun1377
5 Replies

9. Shell Programming and Scripting

Splitting XML file on basis of line number into multiple file

Hi All, I have more than half million lines of XML file , wanted to split in four files in a such a way that top 7 lines should be present in each file on top and bottom line of should be present in each file at bottom. from the 8th line actual record starts and each record contains 15 lines... (14 Replies)
Discussion started by: ajju
14 Replies

10. HP-UX

Mount FIle systems from node-1 onto node-2

Hi, We have HP UX service guard cluster on OS 11.23. Recently 40+ LUNs presented to both nodes by SAN team but I was asked to mount them on only one node. I created required VGs/LVs, created VxFS and mounted all of them and they are working fine. Now client requested those FS on 2nd node as... (4 Replies)
Discussion started by: prvnrk
4 Replies
Xacobeo::Document(3pm)					User Contributed Perl Documentation				    Xacobeo::Document(3pm)

NAME
Xacobeo::Document - An XML document and its related information. SYNOPSIS
use Xacobeo::Document; my $document = Xacobeo::Document->new_from_file('file.xml', 'xml'); my $namespaces = $document->get_namespaces(); # Hashref while (my ($uri, $prefix) = each %{ $namespaces }) { printf "%-5s: %s ", $prefix, $uri; } my $nodes = $document->find('/x:html//x:a[@href]'); foreach my $node ($nodes->get_nodelist) { print "Got node ", $node->name, " "; } $document->validate('/x:html//x:a[@href]') or die "Invalid XPath expression"; DESCRIPTION
This class wraps an XML document with its corresponding meta information (namespaces, XPath context, document node, etc). It inherits from Glib::Object. PROPERTIES
The following properties are defined: source The source of the document. In most cases this will be a path or an URI pointing to the document. type The type of document 'xml' or 'html'. documentNode The document's main node (an instance of XML::LibXML::Node). xpath The XPath conext to be used with the document. namespaces An hashref with the namespaces registered in the document. METHODS
The package defines the following methods: new_from_file Creates a new instance from a file (an URI should also be valid). Parameters: $source: the source of the document, this can be a filename or an URI. $type: the type of document: C<xml> or C<html>. new_from_string Creates a new instance from a string. Parameters: $content: the contents of the document. $type: the type of document: C<xml> or C<html>. empty Returns an empty document. source The source of the document: most likely a file path or an URI. type The type of document: xml or html. namespaces Returns the namespaces declared in the document. The namespaces are returned in a hashref where the URIs are used as a key and the prefix as a value. documentNode Returns the document's node (an instance of XML::LibXML::Document). xpath Returns the XPath context (an instance of XML::LibXML::XPathContext) that includes the namespaces declared in the document. This is the context used to execute all XPath queries. find Runs the given XPath query on the document and returns the results. The results could be a node list or a single value like a boolean, a number or a scalar if an expression is passed. This method always return its values in scalar context. This method croaks if the expression can't be evaluated. Parameters: $xpath: the XPath expression to execute. validate Validates the syntax of the given XPath query. The syntax is validated within a context that has the same namespaces as the ones defined in the current XML document. NOTE: This method can't validate if undefined functions or variables are used. Parameters: $xpath: the XPath expression to validate. get_prefixed_name Returns the node name by prefixing it with our prefixes in the case where namespaces are used. AUTHORS
Emmanuel Rodriguez <potyl@cpan.org>. COPYRIGHT AND LICENSE
Copyright (C) 2008,2009 by Emmanuel Rodriguez. This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.8 or, at your option, any later version of Perl 5 you may have available. perl v5.14.2 2011-11-16 Xacobeo::Document(3pm)
All times are GMT -4. The time now is 08:06 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy