[Israel.pm] Starting XML

Shlomi Fish shlomif at iglu.org.il
Fri Dec 14 05:35:47 PST 2007


On Friday 14 December 2007, Jason Elbaum wrote:
> > Here's how I learned what I know of XML:
> >
> > 1....
> > 2....
> > 3....
> > 4....
> > 5....
>
> 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 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".

XPath will probably be perfect for it. See XML::LibXML and its XPath 
functions. You should understand the basics of XML, learn a little about 
XML::LibXML and DOM and then learn XPath.

>
> I may then process the data directly, or write it out to a text or CSV
> file, or make a database out of it. It won't be going back into XML.
>
> I shouldn't have to know much about XML to do this (no more than I
> already do, in fact), and I shouldn't have to read acres of
> documentation to learn how. Right?

What I suggested wouldn't have required you to read "acres of documentation". 
It's not that long. I read the "Perl and XML" book for fun and enlightenment, 
but you can skip it if you just follow an XPath tutorial.

Regards,

	Shlomi Fish

>
> Regards,
>
> Jason



-- 

---------------------------------------------------------------------
Shlomi Fish      shlomif at iglu.org.il
Homepage:        http://www.shlomifish.org/

I'm not an actor - I just play one on T.V.



More information about the Perl mailing list