10-18-2008
XML root element
Hi All
Can someone please help me with this awk to search an element in a XML file with a particular value and then change the root element.
Thanks & Regards
Karan
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
well i have this xml file here: this file is called filereader.xml
<?xml version="1.0" encoding="UTF-8"?>
<file>
<file1>
<filecopy>/new/test/thefile.txt</filecopy>
<filecopy>/new/test/thefile2.ppt</filecopy>
</file1>
</file>
i need to write the script that search for the Bold text... (2 Replies)
Discussion started by: forevercalz
2 Replies
2. Shell Programming and Scripting
Hi All,
I am looking for a awk/shell which can find an element named REFERENCE in a XML file and check whether it is empty or not.
If there is no value in the REFERENCE element then correspondingly move the file to some other folder.
The Unix server is AIX version 4.
Any inputs... (9 Replies)
Discussion started by: karansachdeva
9 Replies
3. Shell Programming and Scripting
I have a rather large file with XML-style content. Each line contains one full XML entry. For example:
1:<Message><DNIS>1234</DNIS><UCID>3456</UCID><TransferGroup>XYZXYZ</TransferGroup></Message>
2:<Message><DNIS>9999</DNIS><UCID>2584</UCID><TransferGroup>ABCABC</TransferGroup></Message>... (1 Reply)
Discussion started by: sharpi03
1 Replies
4. UNIX Desktop Questions & Answers
Hi, I would need to read an xml element from an xml file to a local variable. Please could you help me with a shell script to get so? Considering that I have a file called file.xml like below:
<header>
<description>This is the description</description>
<content>This is the... (2 Replies)
Discussion started by: oscarmon
2 Replies
5. Shell Programming and Scripting
Any help to extract the root element from an XML file will be appreciated.
Example: test.xml
<?xml version="1.0" encoding="utf-8" ?>
<TestXMLMessage>
<TestRec>
<ID>1000</ID>
</TestRec>
</TestXMLMessage>
Wanted to extract the TestXMLMessage.
Regards,
Chari (6 Replies)
Discussion started by: sree_chari
6 Replies
6. Shell Programming and Scripting
Given this XML:
<?xml version="1.0"?>
<catalog>
<cd>
<title>Empire Burlesque</title>
<artist>Bob Dylan</artist>
<country>USA</country>
<company>Columbia</company>
<price>10.90</price>
<year>1985</year>
</cd>
<cd>
<title>Hide your heart</title>
... (2 Replies)
Discussion started by: ricksj
2 Replies
7. UNIX for Advanced & Expert Users
Hi,
I'm trying to write a script for some xml file handling, but I'm not getting too far with it.
I've got the following xml content
<?xml version="1.0" encoding="UTF-8"?>
<Test xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<Operation name="OPER1">
<Action name="ACTION1">... (2 Replies)
Discussion started by: Juha
2 Replies
8. Shell Programming and Scripting
I want to check if every <Part> element has corresponding <Description> in this sample XML.
....<Lot Of XML>
<Inv lineNumber="2">
<Item>
... (4 Replies)
Discussion started by: kchinnam
4 Replies
9. UNIX for Dummies Questions & Answers
<?xml version = '1.0' encoding =... (8 Replies)
Discussion started by: Siva SQL
8 Replies
10. Shell Programming and Scripting
Hi Team,
I have a CSV file which I have to read through and needs to insert the content within an XML file using Python ONLY ( as most of the code base we have in python only). I managed to find the first part, missing how to insert to XML under "specific" tags.
cat input.csv... (0 Replies)
Discussion started by: panyam
0 Replies
LEARN ABOUT REDHAT
xml::handler::subs
XML::Handler::Subs(3) User Contributed Perl Documentation XML::Handler::Subs(3)
NAME
XML::Handler::Subs - a PerlSAX handler base class for calling user-defined subs
SYNOPSIS
use XML::Handler::Subs;
package MyHandlers;
use vars qw{ @ISA };
sub s_NAME { my ($self, $element) = @_ };
sub e_NAME { my ($self, $element) = @_ };
$self->{Names}; # an array of names
$self->{Nodes}; # an array of $element nodes
$handler = MyHandlers->new();
$self->in_element($name);
$self->within_element($name);
DESCRIPTION
"XML::Handler::Subs" is a base class for PerlSAX handlers. "XML::Handler::Subs" is subclassed to implement complete behavior and to add
element-specific handling.
Each time an element starts, a method by that name prefixed with `s_' is called with the element to be processed. Each time an element
ends, a method with that name prefixed with `e_' is called. Any special characters in the element name are replaced by underscores.
Subclassing XML::Handler::Subs in this way is similar to XML::Parser's Subs style.
XML::Handler::Subs maintains a stack of element names, `"$self-"{Names}', and a stack of element nodes, `"$self-"{Nodes}>' that can be used
by subclasses. The current element is pushed on the stacks before calling an element-name start method and popped off the stacks after
calling the element-name end method. The `"in_element()"' and `"within_element()"' calls use these stacks.
If the subclass implements `"start_document()"', `"end_document()"', `"start_element()"', and `"end_element()"', be sure to use `"SUPER::"'
to call the the superclass methods also. See perlobj(1) for details on SUPER::. `"SUPER::start_element()"' and `"SUPER::end_element()"'
return 1 if an element-name method is called, they return 0 if no method was called.
XML::Handler::Subs does not implement any other PerlSAX handlers.
XML::Handler::Subs supports the following methods:
new( OPTIONS )
A basic `"new()"' method. `"new()"' takes a list of key, value pairs or a hash and creates and returns a hash with those options; the
hash is blessed into the subclass.
in_element($name)
Returns true if `$name' is equal to the name of the innermost currently opened element.
within_element($name)
Returns the number of times the `$name' appears in Names.
AUTHOR
Ken MacLeod, ken@bitsko.slc.ut.us
SEE ALSO
perl(1), PerlSAX.pod(3)
perl v5.8.0 2000-02-22 XML::Handler::Subs(3)