PureBasic - XML
The XML library provides set of functions to easily add XML parsing and creating capability to applications. It is based on the expat XML parser, which is licensed under the MIT license which can be viewed here. expat is used in many projects (like Mozilla or Perl). It is very stable and very fast.
Important: The expat license requires that a copyright notice and the license text itself be included in any software that includes the parser. So if this library (or the API import) are used in software that is to be made public, the above linked license must be included with the software.
The expat functions can also be called directly like other API functions with an ending underscore. This allows to take advantage of expat features not directly provided by this library. The constants and structures defined in expat.h are directly available in PureBasic. A unicode compilation of expat is automatically linked if the Compiler-Switch "Create unicode executable" switch is used. For detailed information on the expat functions, refer to the documentation provided in the download package on http://expat.sourceforge.net/
This library has partial support for Document Type Definitions (DTD) and Namespaces. The goal is to keep the commandset very simple while still allowing this library to handle any XML compliant document.
The expat parser is a non-validating parser. This means it checks the parsed documents for errors in the markup (a document must be well-formed according to the XML specification), but it does not validate the document against a DTD. When parsing a document, this library places DTDs inside a special node in the XML tree with the type #PB_XML_DTD. The content of this node is the full DOCTYPE tag. This way it can be easily accessed and manipulated but is also save to ignore if this information is not needed. The tag is simply written back when exporting/saving the document.
Namespaces do not get resolved when parsing a document. This means that in a document using namespaces, the namespace declarations are accessible as normal node attributes, and node/attribute names using namespaces will be visible as "namespace:tagname". This allows a document using namespaces to be read and also saved back like any other document without destroying its structure. To make working with namespaces simpler, the functions ResolveXMLNodeName() and ResolveXMLAttributeName() are provided to resolve names inside documents that use namespaces.
The PureBasic Debugger provides the possibility to examine #XML objects during runtime with the Library Viewer tool.
The official specification of XML and XML Namespaces by the W3C can be found here:
Various translations of XML related documents
Also the Wikipedia article on XML provides a good starting point for people new to XML.