Click here to get back home

XML file parser

 HomeNewsGroups | Search | About
 comp.lang.perl.modules    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
XML file parser Bryan 04-04-2007
Posted by Bryan on April 4, 2007, 8:33 pm
Please log in for more thread options


What is the best module to use for reading in an XML file, modifying a
field and then writing it back to file? There seem to be a lot of XML
parsers out there....

Thanks,
B

Posted by Sherm Pendley on April 4, 2007, 9:08 pm
Please log in for more thread options



> What is the best module to use for reading in an XML file, modifying a
> field and then writing it back to file? There seem to be a lot of XML
> parsers out there....

That's far too vague to give a useful answer.

Best in what way? Memory use? Speed? Ease of coding? Portability? Do you
want an event-driven parser, a DOM parser, or one that gives you native
Perl data structures like hashes and arrays?

The reason there are so many parsers is that each has strengths and weak-
nesses. There isn't just one "best" module - you have to choose the one
whose strengths are a good fit for the job you're doing.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net

Posted by Ron Savage on April 6, 2007, 8:50 pm
Please log in for more thread options


Bryan wrote:

Hi Bryan

> What is the best module to use for reading in an XML file, modifying a

http://perl-xml.sourceforge.net/faq/

Posted by Tom on April 20, 2007, 1:20 pm
Please log in for more thread options


On Sat, 07 Apr 2007 00:50:24 +0000, Ron Savage wrote...
>
>Bryan wrote:
>
>Hi Bryan
>
>> What is the best module to use for reading in an XML file, modifying a
>
>http://perl-xml.sourceforge.net/faq/


Taking a bit of a crash course in XML/SOAP. I got as far as getting a response
back with XML code but having a tough time parsing it.

Not sure if it's unique to me, but I'm getting a lot of data back as one line.
Is that normal and would that mean I should probably take the "tree" style
approach with XML::Parser?


Tom
--
Help a Community by Participating in Ours
We donate your subscription fees to the charity you choose
100% of your first month, 10% thereafter.
http://newsguy.com/charity.asp


Posted by Sherm Pendley on April 20, 2007, 3:05 pm
Please log in for more thread options



> Taking a bit of a crash course in XML/SOAP. I got as far as getting a response
> back with XML code but having a tough time parsing it.
>
> Not sure if it's unique to me, but I'm getting a lot of data back as one line.
> Is that normal and would that mean I should probably take the "tree" style
> approach with XML::Parser?

The "normal" approach is to use Soap::Lite or some other module to send the
request and parse the response. You don't need to parse XML just to handle a
simple SOAP request. Why reinvent the wheel?

Anyway, to answer your question - callback-based XML parsers don't call your
handler functions for lines of text, they call them for tags. So it doesn't
matter if the XML is one line or a thousand.

sherm--

--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net

Similar ThreadsPosted
A c program which printing the tag value of a xml file using expat parser in linux environment October 25, 2007, 7:05 am
install HTML::Template - Problem reading cache file / Bad file number July 24, 2004, 7:55 pm
Reading contents of an excel file from a test file May 15, 2007, 2:49 am
A do-file location: how the code inside that do-file find it? January 20, 2008, 12:32 am
Need Help with XML::Parser July 5, 2005, 12:53 pm
X500::DN::Parser V 1.16 July 29, 2004, 7:20 am
Can not Install XML::Parser September 29, 2004, 5:26 pm
How to use SGML::Parser? August 2, 2005, 5:18 pm
Possible bug in HTML::Parser November 15, 2005, 5:05 pm
Installing XML Parser May 25, 2006, 2:20 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap