http://swpat.ffii.org/Action against software patents http://www.gnome.org/Gnome2 Logo http://www.w3.org/StatusW3C Logo http://www.redhat.com/Red Hat Logo http://xmlsoft.org/Made with Libxml2 Logo The XML C parser and toolkit of Gnome
The tree output
Developer Menu index.htmlMain Menu html/index.htmlReference Manual examples/index.htmlCode Examples guidelines.htmlXML Guidelines tutorial/index.htmlTutorial xmlreader.htmlThe Reader Interface ChangeLog.htmlChangeLog XSLT.htmlXSLT python.htmlPython and bindings architecture.htmllibxml2 architecture tree.htmlThe tree output interface.htmlThe SAX interface xmlmem.htmlMemory Management xmlio.htmlI/O Interfaces library.htmlThe parser interfaces entities.htmlEntities or no entities namespaces.htmlNamespaces upgrade.htmlUpgrading 1.x code threads.htmlThread safety DOM.htmlDOM Principles example.htmlA real example xml.htmlflat page , site.xslstylesheet API Indexes APIchunk0.htmlAlphabetic APIconstructors.htmlConstructors APIfunctions.htmlFunctions/Types APIfiles.htmlModules APIsymbols.htmlSymbols Related links http://mail.gnome.org/archives/xml/Mail archive http://xmlsoft.org/XSLT/XSLT libxslt http://phd.cs.unibo.it/gdome2/DOM gdome2 http://www.aleksey.com/xmlsec/XML-DSig xmlsec ftp://xmlsoft.org/FTP http://www.zlatkovic.com/projects/libxml/Windows binaries http://www.blastwave.org/packages.php/libxml2Solaris binaries http://www.explain.com.au/oss/libxml2xslt.htmlMacOsX binaries http://libxmlplusplus.sourceforge.net/C++ bindings http://www.zend.com/php5/articles/php5-xmlphp.php#Heading4PHP bindings http://sourceforge.net/projects/libxml2-pas/Pascal bindings http://rubyforge.org/projects/xml-tools/Ruby bindings http://tclxml.sourceforge.net/Tcl bindings http://bugzilla.gnome.org/buglist.cgi?product=libxml2Bug Tracker The parser returns a tree built during the document analysis. The value
returned is an 
xmlDocPtr (i.e., a pointer to an
xmlDoc structure). This structure contains information such
as the file name, the document type, and a 
children pointer
which is the root of the document (or more exactly the first child under the
root which is the document). The tree is made of 
xmlNodes,
chained in double-linked lists of siblings and with a children<->parent
relationship. An xmlNode can also carry properties (a chain of xmlAttr
structures). An attribute may have a value which is a list of TEXT or
ENTITY_REF nodes.
Here is an example (erroneous with respect to the XML spec since there
should be only one ELEMENT under the root):
 structure.gif 
In the source package there is a small program (not installed by default)
called 
xmllint which parses XML files given as argument and
prints them back as parsed. This is useful for detecting errors both in XML
code and in the XML parser itself. It has an option 
--debugwhich prints the actual in-memory structure of the document; here is the
result with the 
#exampleexample  given before:
DOCUMENT
version=1.0
standalone=true
  ELEMENT EXAMPLE
    ATTRIBUTE prop1
      TEXT
      content=gnome is great
    ATTRIBUTE prop2
      ENTITY_REF
      TEXT
      content= linux too 
    ELEMENT head
      ELEMENT title
        TEXT
        content=Welcome to Gnome
    ELEMENT chapter
      ELEMENT title
        TEXT
        content=The Linux adventure
      ELEMENT p
        TEXT
        content=bla bla bla ...
      ELEMENT image
        ATTRIBUTE href
          TEXT
          content=linus.gif
      ELEMENT p
        TEXT
        content=...
This should be useful for learning the internal representation model.
bugs.htmlDaniel Veillard 
