Add missing files
[gmpc-magnatune.git] / src / axl / axl.c
blob45c014f41223860fa9ba6d57efb1c01e9e5acf14
1 /**
2 * @internal
3 *
4 * LibAxl: Another XML library
5 * Copyright (C) 2006 Advanced Software Production Line, S.L.
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public License
9 * as published by the Free Software Foundation; either version 2.1 of
10 * the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this program; if not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 * 02111-1307 USA
22 * You may find a copy of the license under this software is released
23 * at COPYING file. This is LGPL software: you are welcome to
24 * develop proprietary applications using this library without any
25 * royalty or fee but returning back any change, improvement or
26 * addition in the form of source code, project image, documentation
27 * patches, etc.
29 * For commercial support on build XML enabled solutions contact us:
31 * Postal address:
32 * Advanced Software Production Line, S.L.
33 * C/ Dr. Michavila NÂș 14
34 * Coslada 28820 Madrid
35 * Spain
37 * Email address:
38 * info@aspl.es - http://fact.aspl.es
40 #include <axl.h>
42 /**
43 * \mainpage AXL: Another XML Library implementation (XML 1.0 standard)
45 * \section intro Introduction
47 * AXL is a library which aims to implement the XML 1.0 standard, as
48 * defined at the XML 1.0 third edition
49 * recommendation found at: http://www.w3.org/TR/REC-xml/.
51 * It was implemented to support XML requirements inside projects
52 * developed by <a href="http://www.aspl.es">Advanced Software
53 * Production Line, S.L.</a>, especially <a
54 * href="http://fact.aspl.es">Af-Arch</a> and <a
55 * href="http://vortex.aspl.es">Vortex Library</a>, which are already
56 * using the library successfully in production environments.
58 * Main objectives for this library is to provide:
60 * <ul>
62 * <li><b>A clean implementation</b>, that only includes, those elements
63 * defined, and only those, inside the XML 1.0 standard, as defined in <a href="http://www.w3.org/TR/REC-xml/">the third edition</a>.</li>
65 * <li>To be a <b>fast and memory efficient</b> implementation. If you still
66 * think that XML is slow and memory inefficient, you didn't taste Axl
67 * Library. You'll find report about its performance and memory usage at: http://xml.aspl.es/doc.html </li>
69 * <li>Ensure that the library is implemented using abstract data types,
70 * commonly known as opaque types, to avoid exposing details to the
71 * user space code that is consuming the API.
72 * This will allow us to improve the library without breaking existing
73 * code and, the most important, to not be limited by details already
74 * exposed.
75 * In fact, this design have being already used to improve the library
76 * performance greatly. See reports founds at: http://xml.aspl.es/doc.html</a>.</li>
78 * <li>To be <b>small and efficient</b>, ensuring on every stable release that
79 * the library do not leak, not only while using the library in a
80 * proper manner but also when errors were found.
81 * This point is really important for us because Af-Arch server
82 * applications needs to be working for a long time. </li>
84 * <li>Have a <b>modular</b> design that allows to use only those
85 * elements required by your software. At this moment it is provided a
86 * base library (with implements XML 1.0) and an optional library that
87 * provides additional features to support XML Namespaces 1.0.</li>
89 * <li>The other issue is that the Af-Arch client platform should be
90 * easily embedded, so, a <b>small footprint</b> is a requirement. Currently LibAxl (89K) and LibAxl-Ns (9K)</li>
92 * </ul>
94 * \section features_and_status What is the status of the library
96 * Currently the library is stable and it is known to work under
97 * GNU/Linux and Windows with a really good performance. See reports found at http://xml.aspl.es/doc.html to know more about this.
99 * The library already covers the 95% of common requires that XML
100 * development needs. Among others, it support:
102 * - XML tree parsing, from memory and files, allowing a great level
103 * of detail while accessing to the data (comments, process
104 * instructions, xml nodes, and content).
106 * - Mostly completed DTD validation support, including <!ATTLIST>, <!ENTITY>
107 * and <!ELEMENT> elements. Remains to implement NOTATION declarations
108 * and full entity replacement.
110 * - Two modes to inspect the xml documents at the same time,
111 * <b>MIXED API</b>: an API to traverse the document allowing access
112 * to all items found (\ref axlItem) inside the document (\ref
113 * axlDoc) root node (\ref axlNode), and <b>CHILDREN API</b>: an API
114 * that allows to traverse the node using as reference only the nodes
115 * (\ref axlNode) inside the document (\ref axlDoc).
117 * - <a href="http://www.w3.org/TR/REC-xml-names/">XML 1.0
118 * Namespaces</a> full support, through the additional component
119 * (libaxl-ns), allowing to produce xml applications that are
120 * XML Namespace aware.
122 * \section documentation Library Documentation
124 * The library documentation is composed into two pieces. The Axl
125 * manual and the API documentation.
127 * - \ref axl_install
128 * - \ref axl_manual
129 * - \ref axl_api
131 * \section contact_us Contact us
133 * If you find something not properly documented, or some question is
134 * not answered on this documentation, check the <a href="http://www.aspl.es/axl/doc.html">mailing list</a>.
136 * You can also contact us if you have patches, improvements or
137 * suggestions at the mailing list.
140 /**
141 * \page axl_manual XML development with Axl Library
143 * \section Manual Index
145 * On this manual you'll find the following section:
147 * <b>Section 1: Basic elements to understand XML and Axl </b><br>
149 * - \ref intro
150 * - \ref concepts
151 * - \ref two_apis
153 * <b>Section 2: Manipulating and producing XML documents </b><br>
155 * - \ref parsing
156 * - \ref iterating
157 * - \ref modifying
158 * - \ref dumping_functions
160 * <b>Section 3: Doing validation on your documents </b><br>
162 * - \ref validation
163 * - \ref xml_namespace
165 * <b>Section 4: Advanced topics </b><br>
167 * - \ref reducing_foot_print
169 * <b>Apendix</b><br>
171 * - \ref futher
174 * \section intro Introduction: XML development
176 * XML 1.0 definition allows to build documents that could be used to
177 * represents textual information, remote procedure invocations or
178 * dynamic user interfaces. Its definition is based on very simple
179 * principles, that allows to developers to compose them to create
180 * bigger abstractions that are roughly on every place in modern
181 * computer software design.
183 * It is a "quite" human readable format, so you will find that is not
184 * the best format if you are looking for space efficiency. What XML
185 * 1.0 provides you on the other hand is the ability to quickly
186 * prototype and produce working formats that encapsulate your data,
187 * and, as your system evolves, XML 1.0 will do it with you.
189 * Among other things, XML 1.0 provides you ways to validate your
190 * documents to ensure your code will read XML documents in the format
191 * expected, reducing the time and development cost due to additional
192 * checkings required.
194 * Before continuing, we will explain some concepts that are required
195 * to understand XML 1.0 and why the Axl API was built this way.
197 * \section concepts Some concepts before starting to use Axl Library
199 * Here is a simple example of a XML 1.0 document:
200 * <div class="xml-doc">
201 * \code
202 * <?xml version="1.0">
203 * <!-- This is a comment -->
204 * <complex>
205 * <data>
206 * <simple>10</simple>
207 * <empty attr1="value1" />
208 * </data>
209 * </complex>
210 * \endcode
211 * </div>
213 * Previous XML document represents an structure with a top level
214 * node, called <b>complex</b>, that has one single child called
215 * <b>data</b> which in turn have two childs. The first one is the
216 * child called <b>simple</b> that have content and other one, called
217 * <b>empty</b>, which is a node usually called an empty xml node.
219 * The XML representation for previous document is the following:
220 * \image html image01.png "Document representation"
222 * Several issues must be considered while interpreting previous
223 * diagram and how Axl library parse and expose those elements through
224 * the API to the client application:
225 * <ul>
227 * <li>Every XML document have a root node (\ref axl_doc_get_root). Without exception. In this
228 * case, the root node for our example is <b>complex</b>. </li>
230 * <li>If a node have content, that content is not represented with
231 * another node. That content is associated to the node and could be
232 * retrieved using several function (\ref axl_node_get_content, \ref
233 * axl_node_get_content_copy and \ref
234 * axl_node_get_content_trans).
236 * Alternatively, while using the MIXED API, you can traverse child
237 * items stored for a particular node, detecting those items that are
238 * \ref ITEM_CONTENT or \ref ITEM_CDATA (using \ref
239 * axl_item_get_type). </li>
241 * <li>Having a node (\ref axlNode) with content doesn't mean to have a node with
242 * childs. The child notion is only about having more xml nodes (\ref axlNode) as
243 * childs.
245 * This is particularly important if you take into consideration that a
246 * node could have content (\ref ITEM_CONTENT), comments (\ref
247 * ITEM_COMMENT), application process instructions (\ref ITEM_PI),
248 * CDATA content (uninterpreted content \ref ITEM_CDATA), all of them
249 * mixed with more xml nodes (\ref ITEM_NODE). </li>
251 * <li>A final node which is empty because it doesn't have content or
252 * childs, is usually referred to as <b>EMPTY</b> type node. A final
253 * node with content but no childs is usually referred to as
254 * <b>PCDATA</b>. A node that have content mixed with references to
255 * more child xml nodes is referred to as <b>MIXED</b>.</li>
257 * <li>At the <b>empty</b> node, you'll find that it has an attribute
258 * called <b>attr1</b> with a value <b>value1</b>. A node could have
259 * any number of attributes but, it should be named
260 * differently. Again, if a node is empty, it keeps empty even if it
261 * has attributes.
262 * </li>
264 * So, to summarize, we have a root node, that could contain more
265 * nodes, that could contain PCDATA, or content, and those nodes could
266 * contain named attributes with values.
268 * \section two_apis MIXED and CHILDREN API: How to use them
270 * XML 1.0 is used for a variety of purposes, some of them requires
271 * the CHILDREN API and the rest the MIXED API. To <i>require</i>, we
272 * mean that it fits better, so you will get better results, your
273 * application will react in a proper manner and you'll have to do
274 * less work.
276 * The reason for this API is simple. XML 1.0 definition allows to mix
277 * content with more nodes, comments and many more elements to be
278 * placed as childs for a particular node.
280 * This definition, found at the standard, have moved many XML
281 * implementations to support only an API that support all these
282 * features, that is, an interface that is complicated and overloaded,
283 * that gives you a power that you don't require, making your
284 * development more inefficient.
286 * As a result, when a developer only requires a usual form of xml,
287 * called CHILDREN, that means nodes have only another childs
288 * nodes or content but not both at the same time. This kind of xml is
289 * really useful, easy to parse, easy to make a DTD definition, more
290 * compact and extensible.
292 * Lets see an example for both formats to clarify:
294 * <div class="xml-doc">
295 * \code
296 * <?xml version='1.0' ?>
297 * <document>
298 * <!-- Children XML format example: as you can see -->
299 * <!-- nodes only contains either nodes or node content -->
300 * <!-- but nothing mixed at the same level -->
301 * <node1>
302 * This is node1 content
303 * </node1>
304 * <node2>
305 * <node3>
306 * This is node3 content
307 * </node3>
308 * <node4 />
309 * </node2>
310 * </document>
311 * \endcode
312 * </div>
314 * While an MIXED xml document could be:
316 * <div class="xml-doc">
317 * \code
318 * <?xml version='1.0' ?>
319 * <document>
320 * <!-- Children XML format example: as you can see -->
321 * <!-- nodes only contains either nodes or node content -->
322 * <!-- but nothing mixed at the same level -->
323 * <node1>
324 * This is node1 content
325 * </node1>
326 * Content mixed with xml nodes at the same level.
327 * <node2>
328 * More content....
329 * <node3>
330 * This is node3 content
331 * </node3>
332 * <node4 />
333 * </node2>
334 * </document>
335 * \endcode
336 * </div>
338 * Both approaches, which are valid using the XML 1.0 standard, are
339 * appropriate for particular situations:
341 * - CHILDREN API: compact representations, configuration files, rpc
342 * invocation description, graphical user interface definition.
343 * - MIXED API: textual description, for example: XSL-FO.
345 * Having introduced the context of the problem, Axl Library takes no
346 * position, providing an API that fits while developing xml content
347 * that follows a CHILDREN description and an API for the MIXED
348 * description.
350 * In this context, which API you use, will only affect to the way you
351 * traverse the document. The CHILDREN API is mainly provided by the
352 * \ref axl_node_module "Axl Node interface" and the MIXED API is
353 * mainly provided by the \ref axl_item_module "Axl Item interface".
355 * You don't need to do any especial operation to activate both APIs,
356 * both are provided at the same time. Lets see an example:
358 * Supposing the previous mixed example, the following code will get
359 * access to the &lt;node2> reference:
360 * \code
361 * // supposing "doc" reference contains the document loaded
362 * axlNode * node;
364 * // get the document root, that is <document>
365 * node = axl_doc_get_root (doc);
367 * // get the first child for the document root (<node1>)
368 * node = axl_node_get_first_child (node);
370 * // get the next child (brother of <node1>, that is <node2>)
371 * node = axl_node_get_next (node);
372 * \endcode
374 * However, with the MIXED API you can get every detail, every item
375 * found for a particular node. This is how:
377 * \code
378 * // supposing "doc" reference contains the document loaded
379 * axlNode * node;
380 * axlItem * item;
382 * // get the document root, that is <document>
383 * node = axl_doc_get_root (doc);
385 * // get the first item child for the document root that is the comment:
386 * // "Children XML format example: as you can see".
387 * item = axl_item_get_first_child (node);
389 * // now skip the following two comments
390 * item = axl_item_get_next (item);
391 * item = axl_item_get_next (item);
393 * // now the next item is holding the <node1>
394 * item = axl_item_get_next (item);
395 * node = axl_item_get_data (item);
397 * // now get the content between the <node1> and <node2>
398 * item = axl_item_get_next (item);
400 * // and finally, get the next child (brother of <node1>, that is
401 * // <node2>)
402 * item = axl_item_get_next (item);
403 * node = axl_item_get_data (item);
404 * \endcode
406 * Obviously, the mixed example contains more code and it is more
407 * fragile to xml document changes. The problem is that the MIXED API
408 * is more general than the CHILDREN, making XML libraries to only
409 * provide that API.
411 * As a consequence:
413 * - You only need to use the MIXED API (\ref axlItem) if you are
414 * going to do an xml application that allows having content mixed
415 * with nodes, comments, etc, and you want to get access to such
416 * content.
418 * - If you are planing to develop an XML solution that represents
419 * information (user interfaces), module descriptions, configuration
420 * files, etc, try to use the CHILDREN API: it will save you lot of
421 * work! Remember, CHILDREN xml format: childs are either content or
422 * more xml nodes but not both. Never mixed.
424 * \section parsing Parsing XML documents
426 * We have seen how an XML document is. Now we are going to see how to
427 * parse those document into data structures that are usable to
428 * inspect the content. All parsing functions are available at the
429 * \ref axl_doc_module "Axl Doc interface".
431 * Let's start with a very simple example:
433 * \code
434 * #include <axl.h>
435 * #include <stdio.h>
437 * int main (int argc, char ** argv)
439 * axlError ** error;
441 * // top level definitions
442 * axlDoc * doc = NULL;
444 * // initialize axl library
445 * if (! axl_init ()) {
446 * printf ("Unable to initialize Axl library\n");
447 * return -1;
450 * // get current doc reference
451 * doc = axl_doc_parse_from_file ("large.xml", error);
452 * if (doc == NULL) {
453 * axl_error_free (error);
454 * return false;
457 * // DO SOME WORK WITH THE DOCUMENT HERE
459 * // release the document
460 * axl_doc_free (doc);
462 * // cleanup axl library
463 * axl_end ();
465 * return true;
467 * \endcode
469 * \section iterating Traveling an XML document
471 * Once the document is loaded you can use several function to
472 * traverse the document.
474 * First you must use \ref axl_doc_get_root to get the document root
475 * (\ref axlNode) which contains all the information. Then, according
476 * to the interface you are using, you must call to either \ref
477 * axl_node_get_first_child or \ref axl_item_get_first_child.
479 * Once you have access to the first element, you can use the
480 * following set of function to get more references to other nodes or
481 * items:
483 * <ul>
484 * <li><b>MIXED API</b>:
486 * - \ref axl_item_get_first_child
487 * - \ref axl_item_get_last_child
488 * - \ref axl_item_get_next
489 * - \ref axl_item_get_previous
491 * </li>
492 * <li><b>CHILDREN API</b>:
494 * - \ref axl_node_get_first_child
495 * - \ref axl_node_get_last_child
496 * - \ref axl_node_get_next
497 * - \ref axl_node_get_previous
499 * </li>
500 * </ul>
502 * There are alternative APIs that will allow you to iterate the
503 * document, providing a callback: \ref axl_doc_iterate.
505 * Another approach is to use \ref axl_doc_get and \ref
506 * axl_doc_get_content_at to get fast access to a particular node
507 * using a really limited XPath syntax.
509 * \section modifying Modifying a loaded XML document
511 * One feature that comes with Axl Library is ability to modify the
512 * content, replacing it with other content and transferring node node
513 * to another place.
515 * Check the following function while operating with \ref axlNode elements:
517 * - \ref axl_node_replace
518 * - \ref axl_node_remove
519 * - \ref axl_node_transfer_childs
521 * Check the following functions while operating with \ref axlItem elements:
523 * - \ref axl_item_replace
524 * - \ref axl_item_remove
525 * - \ref axl_item_transfer_childs_after
527 * \section dumping_functions Producing xml documents from memory
529 * Axl Library comes with several functions to perform xml memory dump
530 * operations, allowing to translate a xml representation (\ref axlDoc
531 * or \ref axlNode) into a string:
533 * - \ref axl_doc_dump
534 * - \ref axl_doc_dump_pretty
535 * - \ref axl_doc_dump_to_file
536 * - \ref axl_doc_dump_pretty_to_file
538 * In the case you want to produce xml content taking as reference a
539 * particular node use:
541 * - \ref axl_node_dump
542 * - \ref axl_node_dump_pretty
543 * - \ref axl_node_dump_to_file
544 * - \ref axl_node_dump_pretty_to_file
546 * \section validation Validating XML documents
548 * Once you are familiar with the Axl API, or any other XML toolkit,
549 * it turns that it is not a good practice to write lot of source code
550 * to check node names expected or how they are nested. This makes
551 * your program really weak to changes and makes your to write more
552 * code that is not actual work but a simple environment check.
554 * You may also need to check that some XML document received follows
555 * a defined XML structure, but it is too complex to be done.
557 * For this purpose, XML 1.0 defines DTD or (Document Type Definition)
558 * which allows to specify the document grammar, how are nested
559 * nodes, which attributes could contain, or if the are allocated to
560 * be empty nodes or nodes that must have another child nodes.
562 * Let start with the DTD syntax used to configure restrictions about
563 * node structure:
565 * <div class="xml-doc">
566 * \code
567 * <!-- sequence specification -->
568 * <!ELEMENT testA (test1, test2, test3)>
570 * <!-- choice specification -->
571 * <!ELEMENT testB (test1 | test2 | test3)>
572 * \endcode
573 * </div>
576 * DTD <b><!ELEMENT</b> is modeled on top of two concepts which are
577 * later expanded with repetition patterns. We will explain then
578 * later. For now, this two top level concepts are: sequence and choice.
580 * Sequence specification (elements separated by <b>, (comma)</b>, the
581 * one used to apply restriction to the node <b>testA</b>, are used to
582 * denote that <b>testA</b> have as childs test1, followed by test2
583 * and ended by test3. The order specified must be followed and all
584 * instances must appear. This could be tweaked using repetition
585 * pattern.
587 * In the other hand, choice specification (elements separated by
588 * <b>| (pipe)</b>, are used to specify that the content of a node is
589 * built using nodes of the choice list. So, in this case,
590 * <b>testB</b> node could have either one instance of test1 or test2
591 * or test3.
593 * Now you know these to basic elements to model how childs are
594 * organized for a node, what it is need is to keep on adding more
595 * <!ELEMENT directives until all nodes are specified. You will end
596 * your DTD document with final nodes that are either empty ones or
597 * have PCDATA. At this moment MIXED nodes are not supported.
599 * Suppose that all nodes that are inside testA and testB are final
600 * ones. Then this could be its DTD specification:
602 * <div class="xml-doc">
603 * \code
604 * <!-- test1 is a node that only have content -->
605 * <!ELEMENT test1 (#PCDATA)>
607 * <!-- test2 is a node that is always empty -->
608 * <!ELEMENT test1 EMPTY>
610 * <!-- test3 is a node that could have either test1 or test2 -->
611 * <!ELEMENT test3 (test1 | test2)>
612 * \endcode
613 * </div>
615 * Sequences and choices could be composed to create richer DTD
616 * expressions that combines sequences of choices and so on.
618 * At this point all required elements to model choices, sequences and
619 * final nodes are explained, but, we have to talk about repetition
620 * pattern. They are symbols that are appended to elements inside
621 * choices (or sequences) including those list specifications.
623 * Patterns available are: <b>+</b>, <b>?</b> and <b>*</b>. By
624 * default, if no pattern is applied to the element, it means that the
625 * match should be produced one and only one time.
627 * The <b>+</b> pattern is used to model that element should be
628 * matched one, and at least one, or more.
630 * The <b>*</b> pattern is used to model elements that should be
631 * matched zero or any times.
633 * The <b>?</b> pattern is used to model elements that should be
634 * matched zero or one times.
636 * For the exampled initially explained, let's suppose we want that
637 * the content inside <b>testA</b> have sequences repeated at leat one
638 * time, being that sequence: test1, test2 and test3. We only need to
639 * add a <b>+</b> repetition pattern as follows:
641 * <div class="xml-doc">
642 * \code
643 * <!-- sequence specification -->
644 * <!ELEMENT testA (test1, test2, test3)+>
645 * \endcode
646 * </div>
648 * So, we are saying to our validation engine that the sequence inside
649 * testA could be found one or many times, but the entire sequence
650 * match be found every time.
652 * Here is an simple example that loads an XML document, then loads an
653 * DTD file, and then validates the XML document:
654 * \code
655 * bool test_12 (axlError ** error)
657 * axlDoc * doc = NULL;
658 * axlDtd * dtd = NULL;
660 * // parse gmovil file (an af-arch xml chunk)
661 * doc = axl_doc_parse_from_file ("channel.xml", error);
662 * if (doc == NULL)
663 * return false;
665 * // parse af-arch DTD
666 * dtd = axl_dtd_parse_from_file ("channel.dtd", error);
667 * if (dtd == NULL)
668 * return false;
670 * // perform DTD validation
671 * if (! axl_dtd_validate (doc, dtd, error)) {
672 * return false;
675 * // free doc reference
676 * axl_doc_free (doc);
678 * // free dtd reference
679 * axl_doc_free (dtd);
681 * return true;
683 * \endcode
685 * \section xml_namespace Enabling your software with XML Namespaces
687 * XML 1.0 initial design didn't take care about situations where
688 * several software vendors could introduce content inside the same
689 * XML documents. This has several benefits, but one problem to solve:
690 * <i>how to avoid xml node names (tags) to clash from each other.</i>
692 * Think about using &lt;table> as a tag for your document. Many XML
693 * applications uses &lt;table> as a valid tag for its XML language
694 * set. However, each of them has a different meaning and must be
695 * handled by the proper XML software.
697 * While developing applications with XML, and supposing such XML
698 * documents will be used by more applications than yours, you are
699 * likely to be interested in use XML Namespaces. In other words, many
700 * of the new XML standards that are appearing uses XML Namespaces to
701 * allow defining its xml node names, while allowing users/developers
702 * to use their own set of xml tags, under their own XML Namespaces,
703 * in order they can use them in the same document.
705 * XML Namespaces support inside Axl Library is handled through a
706 * separated library, which requires the base library to function. \ref axl_install "Here are some instructions to get Axl Library Namespace installed."
708 * This library provides functions that replaces some of the functions
709 * used by XML applications that don't require XML Namespaces. In
710 * particular, some of them are:
712 * - \ref axl_ns_doc_validate (see this for an example)
713 * - \ref axl_ns_node_cmp
715 * See also API documentation for all functions that are provided to
716 * enable your application with XML Namespaces:
718 * - \ref axl_ns_doc_module
719 * - \ref axl_ns_node_module
721 * \section reducing_foot_print How to reduce the library footprint
723 * Axl Library is implemented in a modular way to ensure you are only
724 * linked against those software elements that you really
725 * require. Additionally, the library allows the following to reduce
726 * the library footprint to the minimum:
728 * <ul>
729 * <li><b>Remove log information:</b> <br> Axl library uses a console log
730 * mechanism to report what's happening during processing. See \ref
731 * axl_log_module "Axl Log reporting" module for more
732 * information. However, under production environments this console
733 * log isn't necessary, so you can safely remove it, at compile time,
734 * using <b>--axl-log-disable</b> as follow:
736 * \code
737 * ./configure --axl-log-disable
738 * \endcode
740 * According to our results, the library including the log to console
741 * information is about <b>366K</b>. Without log to console information the
742 * library takes about <b>288K</b>.
744 * </li>
746 * <li><b>Remove debugging information from the library: </b> <br>You
747 * can also remove debugging information from your library on
748 * production environments doing the following once finished compilation process:
750 * \code
751 * make install-strip
752 * \endcode
754 * According to our results, the library without log to console and
755 * debugging information takes about <b>100K</b>.
757 * </li>
758 * </ul>
760 * Previous information applies to the Axl base Library
761 * (libaxl.so/.dll), however the same happens for the rest of software
762 * components bundle with Axl.
765 * \section futher Futher reading where to go for more information
767 * You can also check \ref axl_api "API documentation" for a complete
768 * detailed explanation about the library.
770 * Please, if you find that something isn't properly documented or you
771 * think that something could be improved, contact us in the mailing
772 * list. We are building Axl Library with the aim to produce a high
773 * quality, commercial grade, open source XML development kit, so, any
774 * help received will be welcome.
776 * Remember you can always contact us at the mailing list for any
777 * question not properly answered by this documentation. See <a
778 * href="http://www.aspl.es/axl/doc.html">Axl Library website
779 * documentation</a> to get more
780 * information about mailing list.
784 /**
785 * \page axl_api LibAxl API documentation
787 * Here is the API for the modules defined inside the library:
789 * <ul>
790 * <li><b>Basic API to interact with XML documents (base library libaxl): </b></li>
792 * - \ref axl_module
793 * - \ref axl_doc_module
794 * - \ref axl_node_module
795 * - \ref axl_node_attribute_cursor
796 * - \ref axl_node_annotate
797 * - \ref axl_item_module
798 * - \ref axl_dtd_module
799 * - \ref axl_decl_module
800 * - \ref axl_handlers
802 * </li>
803 * <li><b>XML Namespaces API (required additional library libaxl-ns): </b></li>
805 * - \ref axl_ns_doc_module
806 * - \ref axl_ns_node_module
808 * </li>
809 * <li><b>Error reporting and debugging functions (base library libaxl): </b></li>
811 * - \ref axl_error_module
812 * - \ref axl_log_module
814 * <li><b>Auxiliary modules, supporting data types, string handling, etc (base library libaxl):</b></li>
816 * - \ref axl_stream_module
817 * - \ref axl_list_module
818 * - \ref axl_list_cursor_module
819 * - \ref axl_stack_module
820 * - \ref axl_hash_module
821 * - \ref axl_hash_cursor_module
822 * - \ref axl_string_module
824 * </li>
825 * </ul>
830 * @page axl_install Installing Axl library and using it
832 * \section intro Introduction
834 * Axl library is an XML library written in ANSI C, which is known to
835 * work on Microsoft Windows, GNU/Linux, *-BSD, GNU/Linux under
836 * Amd64/Itanium and MacOS/X platforms.
838 * Here are a set of instructions to get the library compiled for your
839 * platform:
841 * \section unix GNU/Linux (or any posix OS) installation instructions
843 * First, download the package from the download section. Check <a
844 * href="http://www.aspl.es/axl/doc.html">this section to know more
845 * about this.</a>
847 * Then use the standard procedure to get compiled an autotool ready
848 * package. Here are the steps:
850 * \code
851 * bash: ~$ tar xzvf axl-0.2.1.b1984.g1985.tar.gz
852 * bash: ~$ cd axl-0.2.1.b1984.g1985/
853 * bash: ~/axl-0.2.1.b1984.g1985 $ ./configure
854 * bash: ~/axl-0.2.1.b1984.g1985 $ make
855 * bash: ~/axl-0.2.1.b1984.g1985 $ make install
856 * \endcode
859 * \section windows Windows installation instructions
861 * Axl library comes with packages already built for Microsoft Windows platforms.
862 * Check <a href="http://www.aspl.es/axl/doc.html">the download section to get them</a>.
864 * \section using Using LibAxl library (installations with pkg-config infrastructure)
866 * Axl Library is composed by a base library, which provides all XML
867 * 1.0 function. Additionally, a separated library is provided for
868 * Namespace functions.
870 * Axl library comes with pkg-config support, which makes easy to use
871 * it inside your pkg-config enable projects.
873 * To check current support for your Axl Library you can execute:
875 * \code
876 * bash: ~$ pkg-config --libs --cflags axl
877 * \endcode
879 * In the case you want give support for XML Namespaces, you must use:
880 * \code
881 * bash: ~$ pkg-config --libs --cflags axl-ns
882 * \endcode
884 * To include support into your autotool checks (configure.ac/in
885 * files) you can place the following piece:
886 * \code
887 * PKG_CHECK_MODULES(LIBRARIES, axl)
888 * \endcode
890 * Again, add <b>axl-ns</b> to the previous instruction if you want
891 * your package to also check for Axl Library Namespace support.
893 * \section Including Axl Library headers
895 * For all platforms, Axl Library base headers has to be included as follows:
896 * \code
897 * #include <axl.h>
898 * \endcode
900 * In the case Namespace is required, you must use:
901 * \code
902 * #include <axl_ns.h>
903 * \endcode
908 * \defgroup axl_module Axl main: Init functions for the library
911 /**
912 * \addtogroup axl_module
913 * @{
916 /**
917 * @brief Initializes Axl library.
919 * Currently this function is not required to be executed because
920 * libaxl implementation don't use it. The implementation will try to
921 * make no used for internal variable initialization.
923 * However the API is provided for future usage.
925 * @return The function returns true if it was properly
926 * initialized or false if something fails. if fails.
928 bool axl_init ()
930 /* nothing to initialize dude */
931 return true;
934 /**
935 * @brief Allows to terminate libaxl library function.
937 * Currently this function is not required becasue nothing is done to
938 * stop libaxl function. The implementation will try to keep this,
939 * however, if the future this could be required.
941 void axl_end ()
943 /* nothing to do jack */
944 return;
947 /* @} */