01-16-2016
As a complete newbie to XML, I need help with xmlstarlet. That particular line is just an example of one of the values I need to extract. I don't understand the syntax of how to use xmlstarlet to do that sort of thing. An example would help.
Last edited by gmark99; 01-16-2016 at 10:55 AM..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
1 . Thanks everyone who read the post first.
2 . I have a log file which size is 143M , I can not use vi open it .I can not use xedit open it too.
How to view it ?
If I want to view 200-300 ,how can I implement it
3 . Thanks (3 Replies)
Discussion started by: chenhao_no1
3 Replies
2. Shell Programming and Scripting
I have an xml file:
<AutoData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Table1>
<Data1 10 </Data1>
<Data2 20 </Data2>
<Data3 40 </Data3>
<Table1>
</AutoData>
and I have to remove the portion xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" only.
I tried using sed... (10 Replies)
Discussion started by: Gary1978
10 Replies
3. UNIX for Dummies Questions & Answers
I have a 5000 line config.log file with several "maybe" errors. Any reccomendations on finding solvable problems? (2 Replies)
Discussion started by: NeedLotsofHelp
2 Replies
4. Shell Programming and Scripting
Hi friends..
We have urgent requirement.We need to split the big xml having multiple orders into multiple xmls
having each order in each xml.
For Example
In input XMl will be in following format with multiple line orders..
<OrderDetail BillToKey="20100805337" Createuserid="CreateGuestOrder"... (8 Replies)
Discussion started by: dprakash
8 Replies
5. Shell Programming and Scripting
I have an xml file with the structure:
<tag1>
<value1>xyx</value1>
<value2>123</value2>
</tag1>
<tag1>
<value1>568</value1>
<value2>zzzzz</value2>
</tag1>
where I want to parse each data pair in the this single file, so something like:
find first tag1 data pair... (1 Reply)
Discussion started by: unclecameron
1 Replies
6. Shell Programming and Scripting
Hi All,
I'm stuck with adding multiple lines(irrespective of line number) to a file before a particular xml tag. Please help me.
<A>testing_Location</A>
<value>LA</value>
<zone>US</zone>
<B>Region</B>
<value>Russia</value>
<zone>Washington</zone>
<C>Country</C>... (0 Replies)
Discussion started by: mjavalkar
0 Replies
7. Shell Programming and Scripting
HI All,
I have to split a xml file into multiple xml files and append it in another .xml file. for example below is a sample xml and using shell script i have to split it into three xml files and append all the three xmls in a .xml file. Can some one help plz.
eg:
<?xml version="1.0"?>... (4 Replies)
Discussion started by: ganesan kulasek
4 Replies
8. Shell Programming and Scripting
Hi All,
I have two xml files.
One is having below input
<NameValuePair>
<name>Daemon</name>
<value>tcp:7474</value>
</NameValuePair>
<NameValuePair>
<name>Network</name>
<value></value>
</NameValuePair>
... (2 Replies)
Discussion started by: sharsour
2 Replies
9. Shell Programming and Scripting
Hi,
I'm having a xml file with multiple xml header. so i want to split the file into multiple files.
Sample.xml consists multiple headers so how can we split these multiple headers into multiple files in unix.
eg :
<?xml version="1.0" encoding="UTF-8"?>
<ml:individual... (3 Replies)
Discussion started by: Narendra921631
3 Replies
10. Shell Programming and Scripting
HI
I want to split file base on tag name.
I have few header and footer on file
<?xml version="1.33" encing="UTF-8"?>
<bulkCmConfigDataFile"
<xn:SubNetwork id="ONRM_ROOT">
<xn:MeContext id="PPP04156">
... (4 Replies)
Discussion started by: pareshkp
4 Replies
LEARN ABOUT DEBIAN
xml::sax::expat::incremental
XML::SAX::Expat::Incremental(3pm) User Contributed Perl Documentation XML::SAX::Expat::Incremental(3pm)
NAME
XML::SAX::Expat::Incremental - XML::SAX::Expat subclass for non-blocking (incremental) parsing, with XML::Parser::ExpatNB.
SYNOPSIS
use XML::SAX::Expat::Incremental;
# don't do this, use XML::SAX::ParserFactory
my $p = XML::SAX::Expat::Incremental->new( Handler => MyHandler->new );
$p->parse_start;
while (<DATA>){
$p->parse_more($_); # or $p->parse_string($_);
}
$p->parse_done;
DESCRIPTION
Most XML parsers give a callback interface within an encapsulated loop. That is, you call
$p->parse_whatever($whatever);
And eventually, when $whatever is depleted by the parser, "$p->parse" will return.
Sometimes you don't want the parser to control the loop for you. For example, if you need to retrieve your XML in chunks in a funny way,
you might need to do something like
my $doc = '';
while (defined(my $buffer = get_more_xml())) {
$doc .= $buffer;
}
$p->parse_string($doc);
which is not very convenient, or efficient. You could use perltie to tie a filehandle which does this for you, but that only works some of
the time (for example, say you have two inputs coming in simultaneously).
XML::Parser::ExpatNB solves this by providing three methods:
parse_start
parse_more
parse_done
This interface lets you move the loop to outside the parser, retaining control.
The callbacks are executed in the same manner, just that now, when there is no left to parse, instead of taking more data from a source on
it's own, the parser returns control to you.
$p->parse_start; # you can omit this - parse_start will
# be called automatically as needed
while(defined(my $buffer = get_more_xml())) {
$p->parse_more($buffer);
}
$p->parse_done;
This module is a subclass of XML::SAX::Expat which is to XML::Parser::ExpatXS as XML::SAX::Expat is to XML::Parser itself.
METHODS
parse_string STRING
parse_more STRING
These have the same effect, except that parse_more actually calls parse_string with @_. You might want to use parse_string because in
theory it's more efficient.
This simply continues parsing with the new string, and sends SAX events for the data that is complete in the string.
parse_start
This calls parse_start on the underlying XML::Parser::ExpatNB object. It's called implicitly when you first call parse_string, though,
so you don't have to worry about it.
parse_done
This calls parse_done on the underlying XML::Parser::ExpatNB object. You use it to tell the parser you have no more data to give it.
parse
This is used internally as a sort of parse-anything method. Don't use it, instead use "parse_string", which invokes this method
correctly, and takes simpler options.
SEE ALSO
XML::Parser, XML::SAX, XML::SAX::Expat, XML::SAX::ExpatNB
VERSION CONTROL
This module is maintained using Darcs. You can get the latest version from http://nothingmuch.woobling.org/XML-SAX-Expat-Incremental/
<http://nothingmuch.woobling.org/XML-SAX-Expat-Incremental/>, and use "darcs send" to commit changes.
AUTHOR
Yuval Kogman <nothingmuch@woobling.org>
COPYRIGHT & LICENSE
Copyright (c) 2005 Yuval Kogman. All rights reserved
This program is free software; you can redistribute
it and/or modify it under the same terms as Perl itself.
perl v5.12.4 2007-09-18 XML::SAX::Expat::Incremental(3pm)