| Daniel Veillard | ccb0963 | 1998-10-27 06:21:04 +0000 | [diff] [blame^] | 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> | 
 | 12 | This document describes the <a href="http://www.w3.org/XML/">XML</a> library | 
 | 13 | provideed in the <a href="http://www.gnome.org/">Gnome</a> framework. XML is a | 
 | 14 | standard to build tag based structured documents. The internal document | 
 | 15 | repesentation is as close as possible to the <a | 
 | 16 | href="http://www.w3.org/DOM/">DOM</a> interfaces.</p> | 
 | 17 |  | 
 | 18 | <h2>xml</h2> | 
 | 19 | <p> | 
 | 20 | XML is a standard for markup based structured documents, here is an | 
 | 21 | example:</p> | 
 | 22 | <pre><?xml version="1.0"?> | 
 | 23 | <EXAMPLE prop1="gnome is great" prop2="&linux; too"> | 
 | 24 |   <head> | 
 | 25 |    <title>Welcome to Gnome</title> | 
 | 26 |   </head> | 
 | 27 |   <chapter> | 
 | 28 |    <title>The Linux adventure</title> | 
 | 29 |    <p>bla bla bla ...</p> | 
 | 30 |    <image href="linus.gif"/> | 
 | 31 |    <p>...</p> | 
 | 32 |   </chapter> | 
 | 33 | </EXAMPLE></pre> | 
 | 34 | <p> | 
 | 35 |  </p> | 
 | 36 |  | 
 | 37 | <h2>Invoking the parser</h2> | 
 | 38 |  | 
 | 39 | <h2>The tree output</h2> | 
 | 40 | <p> | 
 | 41 | The parser returns a tree built during the document analysis. The value | 
 | 42 | returned is an <strong>xmlDocPtr</strong> (i.e. a pointer to an | 
 | 43 | <strong>xmlDoc</strong> structure). This structure contains informations like | 
 | 44 | the file  name, the document type, and a <strong>root</strong> pointer which | 
 | 45 | is the root of the document (or more exactly the first child under the root | 
 | 46 | which is the document). The tree is made of <strong>xmlNode</strong>s, chained | 
 | 47 | in double linked lists of siblings and with childs<->parent relationship. | 
 | 48 | An xmlNode can also carry properties (a chain of xmlAttr structures). An | 
 | 49 | attribute may have a value which is a list of TEXT or ENTITY_REF nodes.</p> | 
 | 50 | <p> | 
 | 51 | Here is an example (erroneous w.r.t. the XML spec since there should be only | 
 | 52 | one 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 | 
 | 65 | Model</em> this is an API for accessing XML or HTML structured documents. | 
 | 66 | Native support for DOM in Gnome is on the way (module gnome-dom), and it will | 
 | 67 | be based on gnome-xml. DOM defiles a set of IDL (or Java) interfaces allowing | 
 | 68 | to traverse and manipulate a document. The DOM library will allow accessing | 
 | 69 | and modifying "live" documents presents on other programs like this:</p> | 
 | 70 | <p> | 
 | 71 | <img src="DOM.gif" alt=" DOM.gif "></p> | 
 | 72 | <p> | 
 | 73 | This should help greatly doing things like modifying a gnumeric spreadsheet | 
 | 74 | embedded in a GWP document for example.</p> | 
 | 75 | <p> | 
 | 76 | </p> | 
 | 77 | </body> | 
 | 78 | </html> |