09-26-2012
Need an efficient XML writer for Perl
I don't care about user friendliness, but I don't wanna re-invent the wheel either. What's a good XML writer for Perl that's the most efficient? Thanks!
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
I am very new to XML. Really I have an excel file that I am trying to read w/ Perl on a Linux machine. I don't have a mod for reading excel files so I have to convert the excel file to xml to be able to read it. I can read the file and everything is ok except...the Number style is being dropped... (0 Replies)
Discussion started by: vincaStar
0 Replies
3. Shell Programming and Scripting
In the case that there are two cells under one row, I can only read the first cell. If anyone thinks they know how to deal with this please let me know.
XML code:
<Row>
<Cell><Data ss:Type="String">Loved</Data></Cell>
<Cell ss:Index="3"><Data ss:Type="Number">3.0</Data></Cell>
... (1 Reply)
Discussion started by: vincaStar
1 Replies
4. Shell Programming and Scripting
Hi there,
I have need create and read (Handle) XML in perl, a lib with oop support. are you can present suitable library for this?
Thanks in advance. (1 Reply)
Discussion started by: Zaxon
1 Replies
5. Programming
Hi there,
I'm newby in perl and XML. I can read and parse Xml with XML-Node upper XML::Parser, but how can I create XML tags and pack my individual data in it then send through socket. PLZ lead me :)
Thanks in Advance. (1 Reply)
Discussion started by: Zaxon
1 Replies
6. Shell Programming and Scripting
Hi there,
I'm newby in perl and XML. I can read and parse Xml with XML-Node upper XML::Parser, but how can I create XML tags and pack my individual data in it then send through socket. PLZ lead me :)
Meanwhile what is your opinion about XML Writer library?
Thanks in Advance. (2 Replies)
Discussion started by: Zaxon
2 Replies
7. Shell Programming and Scripting
Hi,
I have 2 questions:
a) Does getElementsByTagName in xml takes more time?
b) If it takes more time what are the other alternatives used to get the tag names?
For example:
<Student>
<Studname>aaa</Studname>
<Studno>123</Studno>
</Student>
This is just a sample data. The file... (2 Replies)
Discussion started by: vanitham
2 Replies
8. Shell Programming and Scripting
Hi,
I have an XML file with around 1 billion rows in it and i am trying to find the number of times a particular tag occurs in it. The solution i am using works but takes a lot of time (~1 hr) .Please help me with an efficient way to do this.
Lets say the input file is
<Root>
... (13 Replies)
Discussion started by: Sheel
13 Replies
9. Programming
Hi,
Am pretty new for perl scripting and confused how to use XML Parser..
I just want to know how to use perl and XML parser..
The scenario is when i execute a command, it will generate a XML file..
From that XML file generated i need to grep for specific term that has HTML TAG say... (2 Replies)
Discussion started by: Priya Amaresh
2 Replies
10. Shell Programming and Scripting
Hi Everyone,
I'm new here and I was checking this old post:
/shell-programming-and-scripting/180669-splitting-file-into-several-smaller-files-using-perl.html
(cannot paste link because of lack of points)
I need to do something like this but understand very little of perl.
I also check... (4 Replies)
Discussion started by: mcosta
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)