Perl XML::LibXML by Example

The XML::LibXML Perl module is a wrapper around the libxml2 parser library which is written in C. This tutorial uses example code to introduce the features of XML::LibXML and the ways in which you can use the module. The example scripts and XML documents are available as a ZIP file download.

Get started with a basic example or jump directly to a specific topic using the Table of Contents.

Alternate Formats

The primary target for this project is the set of HTML pages. Alternate formats are available but may be missing some elements or features which are present in the HTML:

Corrections and Updates

If you spot errors in the text of this document, please raise an issue on GitHub. You are also welcome to fork the project, commit a fix and raise a pull request.

If you find this document useful please link to it from your blogs, tweets, Stack Overflow answers etc. The canonical URL for linking is


In alphabetical order:

  • Brandon Youngdale
  • Grant McLean