Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Parsing XML - right scripting languages / packages for the job?

I know that any language is capable of parsing XML; I'm really just looking for advantages or drawbacks that you may have come across in your own experiences. Perl would be my standard go to here, but I'm open to suggestions.

Thanks!

UPDATE: I ended up going with XML::Simple which did a nice job, but I have one piece of advice if you plan to use it--research the forcearray option first. I had to rewrite a bunch of statements after learning that it is usually best practice to set forcearray. This page had the clearest explanation that I could find. Frankly, I'm surprised this isn't the default behavior.

like image 322
nedblorf Avatar asked Oct 23 '09 12:10

nedblorf


People also ask

What is XML scripting language?

XML stands for Extensible Markup Language. It is a text-based markup language derived from Standard Generalized Markup Language (SGML). XML tags identify the data and are used to store and organize the data, rather than specifying how to display it like HTML tags, which are used to display the data.

How does XML parsing work?

XML parser is a software library or a package that provides interface for client applications to work with XML documents. It checks for proper format of the XML document and may also validate the XML documents. Modern day browsers have built-in XML parsers. The goal of a parser is to transform XML into a readable code.


2 Answers

If you are using Perl then I would recommend XML::Simple:

As more and more Web sites begin using XML for their content, it's increasingly important for Web developers to know how to parse XML data and convert it into different formats. That's where the Perl module called XML::Simple comes in. It takes away the drudgery of parsing XML data, making the process easier than you ever thought possible.

like image 139
Andrew Hare Avatar answered Oct 12 '22 23:10

Andrew Hare


XML::Twig is very nice, especially because it’s not as awfully verbose as some of the other options.

like image 41
zoul Avatar answered Oct 13 '22 00:10

zoul