Blame doc/html/tutorial.html

rpm-build d9acb6
rpm-build d9acb6
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
rpm-build d9acb6
<head>
rpm-build d9acb6
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
rpm-build d9acb6
<meta name="generator" content="Docutils 0.12: http://docutils.sourceforge.net/" />
rpm-build d9acb6
<title>The lxml.etree Tutorial</title>
rpm-build d9acb6
<meta name="author" content="Stefan Behnel" />
rpm-build d9acb6
<meta content="The lxml tutorial on XML processing with Python" name="description" />
rpm-build d9acb6
<meta content="XML processing with Python, lxml, lxml.etree, tutorial, ElementTree, Python, XML, HTML" name="keywords" />
rpm-build d9acb6
<link rel="stylesheet" href="style.css" type="text/css" />
rpm-build d9acb6
<script type="text/javascript">
rpm-build d9acb6
function trigger_menu(event) {
rpm-build d9acb6
    var sidemenu = document.getElementById("sidemenu");
rpm-build d9acb6
    var classes = sidemenu.getAttribute("class");
rpm-build d9acb6
    classes = (classes.indexOf(" visible") === -1) ? classes + " visible" : classes.replace(" visible", "");
rpm-build d9acb6
    sidemenu.setAttribute("class", classes);
rpm-build d9acb6
    event.preventDefault();
rpm-build d9acb6
    event.stopPropagation();
rpm-build d9acb6
}
rpm-build d9acb6
function hide_menu() {
rpm-build d9acb6
    var sidemenu = document.getElementById("sidemenu");
rpm-build d9acb6
    var classes = sidemenu.getAttribute("class");
rpm-build d9acb6
    if (classes.indexOf(" visible") !== -1) {
rpm-build d9acb6
        sidemenu.setAttribute("class", classes.replace(" visible", ""));
rpm-build d9acb6
    }
rpm-build d9acb6
}
rpm-build d9acb6
</script><meta content="width=device-width, initial-scale=1" name="viewport" /></head>
rpm-build d9acb6
<body onclick="hide_menu()">
rpm-build d9acb6
rpm-build d9acb6

The lxml.etree Tutorial

rpm-build d9acb6
rpm-build d9acb6
rpm-build d9acb6
rpm-build d9acb6
rpm-build d9acb6
Author:
rpm-build d9acb6
Stefan Behnel
rpm-build d9acb6
rpm-build d9acb6
rpm-build d9acb6

This is a tutorial on XML processing with <tt class="docutils literal">lxml.etree</tt>. It briefly

rpm-build d9acb6
overviews the main concepts of the ElementTree API, and some simple
rpm-build d9acb6
enhancements that make your life as a programmer easier.

rpm-build d9acb6

For a complete reference of the API, see the generated API

rpm-build d9acb6
documentation.

rpm-build d9acb6
rpm-build d9acb6

Contents

rpm-build d9acb6
    rpm-build d9acb6
  • The Element class
    • rpm-build d9acb6
    • Elements are lists
    • rpm-build d9acb6
    • Elements carry attributes as a dict
    • rpm-build d9acb6
    • Elements contain text
    • rpm-build d9acb6
    • Using XPath to find text
    • rpm-build d9acb6
    • Tree iteration
    • rpm-build d9acb6
    • Serialisation
    • rpm-build d9acb6
      rpm-build d9acb6
      rpm-build d9acb6
    • The ElementTree class
    • rpm-build d9acb6
    • Parsing from strings and files
      • rpm-build d9acb6
      • The fromstring() function
      • rpm-build d9acb6
      • The XML() function
      • rpm-build d9acb6
      • The parse() function
      • rpm-build d9acb6
      • Parser objects
      • rpm-build d9acb6
      • Incremental parsing
      • rpm-build d9acb6
      • Event-driven parsing
      • rpm-build d9acb6
        rpm-build d9acb6
        rpm-build d9acb6
      • Namespaces
      • rpm-build d9acb6
      • The E-factory
      • rpm-build d9acb6
      • ElementPath
      • rpm-build d9acb6
        rpm-build d9acb6
        rpm-build d9acb6

        A common way to import <tt class="docutils literal">lxml.etree</tt> is as follows:

        rpm-build d9acb6
        >>> from lxml import etree