xml.html revision ccb096379ac43c44755023007ee1dc9e61fbeec7
1<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"
2   "http://www.w3.org/TR/REC-html40/loose.dtd">
3<html>
4<head>
5<title>No title</title>
6<meta name="GENERATOR" content="amaya V1.3b">
7</head>
8<body bgcolor="#ffffff">
9
10<h1 align="center">The XML library for Gnome</h1>
11<p>
12This document describes the <a href="http://www.w3.org/XML/">XML</a> library
13provideed in the <a href="http://www.gnome.org/">Gnome</a> framework. XML is a
14standard to build tag based structured documents. The internal document
15repesentation is as close as possible to the <a
16href="http://www.w3.org/DOM/">DOM</a> interfaces.</p>
17
18<h2>xml</h2>
19<p>
20XML is a standard for markup based structured documents, here is an
21example:</p>
22<pre>&lt;?xml version="1.0"?>
23&lt;EXAMPLE prop1="gnome is great" prop2="&amp;linux; too">
24  &lt;head>
25   &lt;title>Welcome to Gnome&lt;/title>
26  &lt;/head>
27  &lt;chapter>
28   &lt;title>The Linux adventure&lt;/title>
29   &lt;p>bla bla bla ...&lt;/p>
30   &lt;image href="linus.gif"/>
31   &lt;p>...&lt;/p>
32  &lt;/chapter>
33&lt;/EXAMPLE></pre>
34<p>
35 </p>
36
37<h2>Invoking the parser</h2>
38
39<h2>The tree output</h2>
40<p>
41The parser returns a tree built during the document analysis. The value
42returned is an <strong>xmlDocPtr</strong> (i.e. a pointer to an
43<strong>xmlDoc</strong> structure). This structure contains informations like
44the file  name, the document type, and a <strong>root</strong> pointer which
45is the root of the document (or more exactly the first child under the root
46which is the document). The tree is made of <strong>xmlNode</strong>s, chained
47in double linked lists of siblings and with childs&lt;->parent relationship.
48An xmlNode can also carry properties (a chain of xmlAttr structures). An
49attribute may have a value which is a list of TEXT or ENTITY_REF nodes.</p>
50<p>
51Here is an example (erroneous w.r.t. the XML spec since there should be only
52one ELEMENT under the root):</p>
53<p>
54<img src="structure.gif" alt=" structure.gif "></p>
55<p>
56</p>
57
58<h2>Modifying the tree</h2>
59
60<h2>Saving a tree</h2>
61
62<h2>DOM interfaces</h2>
63<p>
64<a href="http://www.w3.org/DOM/">DOM</a> stands for the <em>Document Object
65Model</em> this is an API for accessing XML or HTML structured documents.
66Native support for DOM in Gnome is on the way (module gnome-dom), and it will
67be based on gnome-xml. DOM defiles a set of IDL (or Java) interfaces allowing
68to traverse and manipulate a document. The DOM library will allow accessing
69and modifying "live" documents presents on other programs like this:</p>
70<p>
71<img src="DOM.gif" alt=" DOM.gif "></p>
72<p>
73This should help greatly doing things like modifying a gnumeric spreadsheet
74embedded in a GWP document for example.</p>
75<p>
76</p>
77</body>
78</html>
79