Re: Xpath
Stephen Wilcoxon <[email protected]> Sun, 9 Dec 2012 22:14:10 -0600
| Newsgroups | gmane.comp.lang.perl.xml |
|---|---|
| Message-ID | <CAOhatNwuPSw2UK3GQ_cULWgvK-WCFW53V_OX7MuE6YLzKQJxZg@mail.gmail.com> |
--===============0888966963== Content-Type: multipart/alternative; boundary=f46d042f9428179a7f04d077cc8c --f46d042f9428179a7f04d077cc8c Content-Type: text/plain; charset=ISO-8859-1 XML::LibXML::SAX seems to be fairly poorly documented (but that's true of all of XML::LibXML). I would discourage the use of a DOM parser as it reads everything into memory so suffers performance issues as documents get larger (and can run out of memory). If I'm going to read everything into memory, I just use XML::Simple. I would highly recommend using the XML::SAX stack - XML::SAX, XML::SAX::Machines, XML::SAX::Writer, XML::SAX::Base, and one of the better performing parsers (I'm currently eyeing XML::SAX::ExpatXS but you could use XML::LibXML::SAX or another one if you prefer). SAX is designed for XML transformations like you are talking about. The core of SAX is also language-agnostic (SAX is heavily used in Java XML processing) - it's just the extras like XML::SAX::Machines that are specific to Perl (as far as I'm aware). SAX is also much more powerful than DOM in what it can accomplish (read through XML::SAX::Intro, XML::SAX, and XML::SAX::Machines and give some thought to the things that can be done with SAX). In the near future, I will be benchmarking some of the different XML::SAX parsers and checking for consistency (iirc, it will be XML::SAX::Expat, XML::SAX::ExpatXS, XML::LibXML::SAX, and I think one other). >From what I've read, XML::Twig could also easily be used to do what you want but I have not used it. --f46d042f9428179a7f04d077cc8c Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable XML::LibXML::SAX seems to be fairly poorly documented (but that's true = of all of XML::LibXML).<div><br></div><div>I would discourage the use of a = DOM parser as it reads everything into memory so suffers performance issues= as documents get larger (and can run out of memory). =A0If I'm going t= o read everything into memory, I just use XML::Simple.<br> </div><div><br></div><div>I would highly recommend using the XML::SAX stack= - XML::SAX, XML::SAX::Machines, XML::SAX::Writer, XML::SAX::Base, and one = of the better performing parsers (I'm currently eyeing XML::SAX::ExpatX= S but you could use XML::LibXML::SAX or another one if you prefer). =A0SAX = is designed for XML transformations like you are talking about. =A0The core= of SAX is also language-agnostic (SAX is heavily used in Java XML processi= ng) - it's just the extras like XML::SAX::Machines that are specific to= Perl (as far as I'm aware). =A0SAX is also much more powerful than DOM= in what it can accomplish (read through XML::SAX::Intro, XML::SAX, and XML= ::SAX::Machines and give some thought to the things that can be done with S= AX). =A0In the near future, I will be benchmarking some of the different XM= L::SAX parsers and checking for consistency (iirc, it will be XML::SAX::Exp= at, XML::SAX::ExpatXS, XML::LibXML::SAX, and I think one other).</div> <div><br></div><div>From what I've read, XML::Twig could also easily be= used to do what you want but I have not used it.</div> --f46d042f9428179a7f04d077cc8c-- --===============0888966963== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Perl-XML mailing list [email protected] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs --===============0888966963==--