A Tutorial for using LibXML from Perl
In my ongoing crusade to direct people away from XML::Simple and towards XML::LibXML, I've recently published a documentation project called "Perl XML::LibXML by Example". The primary target of this documentation is the desperate Perl hacker who might otherwise reach for XML::Simple without realising the awful horrors that module will inflict upon them. My hope is that by pointing people at this documentation we'll be able to help them solve their problems sooner and with less pain.
In helping people with their Perl and XML problems I've come to realise that in order to become proficient with XML::LibXML what people really need (and what I've aimed to provide) is:
- Complete, working code samples that they can copy and adapt to their needs.
- Line-by-line explanations of what that example code is doing and why.
- An introduction to what XPath is, and a range of example XPath expressions from the trivial to the complex with explanations of how they work.
- A primer on the Document Object Model that concentrates on the tiny subset of methods that most of us actually need.
The documentation is structured in such a way that there's one obvious place for an absolute beginner to start but multiple other entry points for people to dip into specific subjects such as: XPath expressions; the DOM; namespaces; and using libxml with HTML. Along the way it provides multiple links to the official documentation so people know where to go when they need more information.
So please take a look at the site and if you are answering questions about Perl and XML, please consider linking to it in order to set people on the right path.
The full source for the project is up on GitHub so you can raise issues or fork the repository and raise pull requests to make it even better.