[Israel.pm] Starting XML

Yuval Kogman nothingmuch at woobling.org
Fri Dec 14 03:03:54 PST 2007

On Fri, Dec 14, 2007 at 12:48:55 +0200, Jason Elbaum wrote:
> See, that's just the thing. I don't want to learn all that about XML,
> at least not right now. I don't want to mangle it, transform it or
> validate it.

I think Gaal's advice was sound then. Start with XML::Simple, and if
you outgrow it only then bother learning more.

XML::Simple is a bit like a serialization module, loading the entire
XML into a native perl data structure.

> I just want to parse a relatively small, relatively simple XML file
> and easily extract the contents. I want to say, "Please give me the
> contents of the foo attribute in all the bar tags which are nested
> within baz tags with attribute quz." Or "Iterate over the fred tags
> and give me their smludges".

Your extraction requirements do sound like XPath would be a perfect
fit though, so I do suggest you at least learn a bit about that.

It's very simple and intuitive, and useful for things beyond XML -
it's a general query language for trees (Tree::XPathEngine provides
a reusable API for any tree).

  Yuval Kogman <nothingmuch at woobling.org>
http://nothingmuch.woobling.org  0xEBD27418

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://perl.org.il/pipermail/perl/attachments/20071214/6c420a90/attachment.pgp 

More information about the Perl mailing list