The parser returns a tree built during the document analysis. The
valuereturned is an xmlDocPtr(i.e., a pointer to
anxmlDocstructure). This structure contains information
suchas the file name, the document type, and a
childrenpointerwhich is the root of the document (or more
exactly the first child under theroot which is the document). The tree is
made of xmlNodes,chained in double-linked lists of siblings
and with a children<->parentrelationship. An xmlNode can also carry
properties (a chain of xmlAttrstructures). An attribute may have a value
which is a list of TEXT orENTITY_REF nodes. Here is an example (erroneous with respect to the XML spec since
thereshould be only one ELEMENT under the root): 
In the source package there is a small program (not installed by
default)called xmllintwhich parses XML files given as
argument andprints them back as parsed. This is useful for detecting errors
both in XMLcode and in the XML parser itself. It has an option
--debugwhich prints the actual in-memory structure of the
document; here is theresult with the examplegiven
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. Daniel Veillard |