Preparing for debian package
[ACL.git] / doc / xml.xml
1 <chapter>
2 <heading>xml - XML document classes</heading>
3
4 <pre>
5 #include &lt;xml.h&gt;
6
7 xml document;
8 xml_node node;
9 xml_element element;
10 </pre>
11
12 <para>
13 The collection of xml classes provide an easy way to process XML documents
14 and to traverse the tree of XML data.
15 Built upon the xml2 library on xmlsoft.org, the classes encapsulate concepts
16 of XML data.
17 After parsing an XML document with an xml object, the xml_node class
18 can access the data of the XML document tree.
19 A node in the tree can have any number of children which are also nodes.
20 The child nodes are accessed by using the subscript operator with a numerical index.
21 Elements of the XML data can be selected by name when a String argument is used
22 with the subscript operator.
23 Using this operator will return a vector of xml_element objects that hold
24 all child elements having this name.
25 <pre>
26
27 xml data(filename);
28 xml_node root(data);
29 xml_node third = root[2];
30
31 String tagname("chapter");
32 std::vector &lt;xml_element&gt; all_chapters;
33
34 all_chapters = root[tagname];
35
36 </pre>
37 </para>
38 <section>
39 <heading>Class xml</heading>
40 <para>
41 An object of class xml holds an entire XML document.
42 It supports reading and writing XML documents from and to files
43 as well conversion of XML objects to and from String objects.
44
45 <description>
46 <item tag="xml()">
47 The default constructor creates an empty xml document.
48 </item>
49 <item tag="xml(String s)">
50 Parse the xml document from s.
51 </item>
52 </description>
53 </para>
54
55 <description>
56 <item tag="operator=(String &amp;s)">
57 Parse the xml document from String s.
58 </item>
59 </description>
60
61 </section>
62
63 <section>
64 <heading>class xml_node</heading>
65
66 <para>
67 A node is the basic building block that makes up the tree of an XML document.
68 There are several kinds of nodes, such as ekements, attributes and text nodes.
69 If a node is an ekement node it can have any number if child nodes.
70 These child nodes can be accessed by using the subscript operator with
71 a numerical index.
72 </para>
73
74 <description>
75 <item tag="xml_node()">
76 The default constructor creates an empty xml node.
77 </item>
78 <item tag="xml_node(xml doc)">
79 Construct a node from the XML document. The xml_node object will be the root node
80 of the XML document.
81 </item>
82 <item tag="bool is_a_node(void)">
83 Return true if the object actually is an XML node.
84 </item>
85 <item tag="xml_node operator[](int n)">
86 Return the child node with index n.
87 </item>
88 </description>
89 </section>
90
91 <section>
92 <heading>class xml_element : xml_node</heading>
93 <para>
94 The class xml_element is derived from the class xml_node and adds properties
95 specific to XML elements.
96 </para>
97 <description>
98 <item tag="xml_element()">
99 The default constructor creates an empty xml element.
100 </item>
101 <item tag="xml_element(xml doc)">
102 Construct an element from the XML document. The xml_element object will be the root element
103 of the XML document.
104 </item>
105 <item tag="std::vector&lt;xml_element&gt; operator[](String tagname);">
106 Find the child elements with the specified tagname.
107 </item>
108 </description>
109
110 </section>
111
112 </chapter>