|
Packit Service |
a31ea6 |
|
|
Packit Service |
a31ea6 |
|
|
Packit Service |
a31ea6 |
<html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><link rel="SHORTCUT ICON" href="/favicon.ico" /><style type="text/css">
|
|
Packit Service |
a31ea6 |
TD {font-family: Verdana,Arial,Helvetica}
|
|
Packit Service |
a31ea6 |
BODY {font-family: Verdana,Arial,Helvetica; margin-top: 2em; margin-left: 0em; margin-right: 0em}
|
|
Packit Service |
a31ea6 |
H1 {font-family: Verdana,Arial,Helvetica}
|
|
Packit Service |
a31ea6 |
H2 {font-family: Verdana,Arial,Helvetica}
|
|
Packit Service |
a31ea6 |
H3 {font-family: Verdana,Arial,Helvetica}
|
|
Packit Service |
a31ea6 |
A:link, A:visited, A:active { text-decoration: underline }
|
|
Packit Service |
a31ea6 |
</style><title>The tree output</title></head><body bgcolor="#8b7765" text="#000000" link="#a06060" vlink="#000000"> | | The XML C parser and toolkit of GnomeThe tree output |
|
|
<center>Developer Menu</center> | <form action="search.php" enctype="application/x-www-form-urlencoded" method="get"><input name="query" type="text" size="20" value="" /><input name="submit" type="submit" value="Search ..." /></form> |
<center>API Indexes</center> | |
<center>Related links</center> | |
|
| The parser returns a tree built during the document analysis. The value |
|
|
|
|
|
|
Packit Service |
a31ea6 |
returned is an xmlDocPtr (i.e., a pointer to an
|
|
Packit Service |
a31ea6 |
xmlDoc structure). This structure contains information such
|
|
Packit Service |
a31ea6 |
as the file name, the document type, and a children pointer
|
|
Packit Service |
a31ea6 |
which is the root of the document (or more exactly the first child under the
|
|
Packit Service |
a31ea6 |
root which is the document). The tree is made of xmlNodes,
|
|
Packit Service |
a31ea6 |
chained in double-linked lists of siblings and with a children<->parent
|
|
Packit Service |
a31ea6 |
relationship. An xmlNode can also carry properties (a chain of xmlAttr
|
|
Packit Service |
a31ea6 |
structures). An attribute may have a value which is a list of TEXT or
|
|
Packit Service |
a31ea6 |
ENTITY_REF nodes.Here is an example (erroneous with respect to the XML spec since there
|
|
Packit Service |
a31ea6 |
should be only one ELEMENT under the root):In the source package there is a small program (not installed by default)
|
|
Packit Service |
a31ea6 |
called xmllint which parses XML files given as argument and
|
|
Packit Service |
a31ea6 |
prints them back as parsed. This is useful for detecting errors both in XML
|
|
Packit Service |
a31ea6 |
code and in the XML parser itself. It has an option --debug
|
|
Packit Service |
a31ea6 |
which prints the actual in-memory structure of the document; here is the
|
|
Packit Service |
a31ea6 |
result with the example given before:DOCUMENT
|
|
Packit Service |
a31ea6 |
version=1.0
|
|
Packit Service |
a31ea6 |
standalone=true
|
|
Packit Service |
a31ea6 |
ELEMENT EXAMPLE
|
|
Packit Service |
a31ea6 |
ATTRIBUTE prop1
|
|
Packit Service |
a31ea6 |
TEXT
|
|
Packit Service |
a31ea6 |
content=gnome is great
|
|
Packit Service |
a31ea6 |
ATTRIBUTE prop2
|
|
Packit Service |
a31ea6 |
ENTITY_REF
|
|
Packit Service |
a31ea6 |
TEXT
|
|
Packit Service |
a31ea6 |
content= linux too
|
|
Packit Service |
a31ea6 |
ELEMENT head
|
|
Packit Service |
a31ea6 |
ELEMENT title
|
|
Packit Service |
a31ea6 |
TEXT
|
|
Packit Service |
a31ea6 |
content=Welcome to Gnome
|
|
Packit Service |
a31ea6 |
ELEMENT chapter
|
|
Packit Service |
a31ea6 |
ELEMENT title
|
|
Packit Service |
a31ea6 |
TEXT
|
|
Packit Service |
a31ea6 |
content=The Linux adventure
|
|
Packit Service |
a31ea6 |
ELEMENT p
|
|
Packit Service |
a31ea6 |
TEXT
|
|
Packit Service |
a31ea6 |
content=bla bla bla ...
|
|
Packit Service |
a31ea6 |
ELEMENT image
|
|
Packit Service |
a31ea6 |
ATTRIBUTE href
|
|
Packit Service |
a31ea6 |
TEXT
|
|
Packit Service |
a31ea6 |
content=linus.gif
|
|
Packit Service |
a31ea6 |
ELEMENT p
|
|
Packit Service |
a31ea6 |
TEXT
|
|
Packit Service |
a31ea6 |
content=...This should be useful for learning the internal representation model. Daniel Veillard </body></html>
|