Libxml Tutorial    ar01s02.htmlNext Libxml Tutorial
John Fleck
Copyright © 2002, 2003 John Fleck
Revision History Revision 1 June 4, 2002 Initial draft Revision 2 June 12, 2002 retrieving attribute value added Revision 3 Aug. 31, 2002 freeing memory fix Revision 4 Nov. 10, 2002 encoding discussion added Revision 5 Dec. 15, 2002 more memory freeing changes Revision 6 Jan. 26. 2003 add index Revision 7 April 25, 2003 add compilation appendix Revision 8 July 24, 2003 add XPath example Revision 9 Feb. 14, 2004 Fix bug in XPath example Revision 7 Aug. 24, 2004 Fix another bug in XPath example Table of Contents
index.html#introductionIntroduction ar01s02.htmlData Types ar01s03.htmlParsing the file ar01s04.htmlRetrieving Element Content ar01s05.htmlUsing XPath to Retrieve Element Content ar01s06.htmlWriting element content ar01s07.htmlWriting Attribute ar01s08.htmlRetrieving Attributes ar01s09.htmlEncoding Conversion A. apa.htmlCompilation B. apb.htmlSample Document C. apc.htmlCode for Keyword Example D. apd.htmlCode for XPath Example E. ape.htmlCode for Add Keyword Example F. apf.htmlCode for Add Attribute Example G. apg.htmlCode for Retrieving Attribute Value Example H. aph.htmlCode for Encoding Conversion Example I. api.htmlAcknowledgements Abstract
Libxml is a freely licensed C language library for handling
    
XML, portable across a large number of platforms. This
    tutorial provides examples of its basic functions.
Introduction
Libxml is a C language library implementing functions for reading,
      creating and manipulating 
XML data. This tutorial
    provides example code and explanations of its basic functionality.
Libxml and more details about its use are available on http://www.xmlsoft.org/the project home page . Included there is complete http://xmlsoft.org/html/libxml-lib.html	
API documentation . This tutorial is not meant
    to substitute for that complete documentation, but to illustrate the
    functions needed to use the library to perform basic operations.
The tutorial is based on a simple XML application I
    use for articles I write. The format includes metadata and the body
    of the article.
The example code in this tutorial demonstrates how to:
      
Parse the document.
Extract the text within a specified element.
Add an element and its content.
Add an attribute.
Extract the value of an attribute.
    
Full code for the examples is included in the appendices.
   ar01s02.htmlNext    Data Types 