1xmlparsing(3)                        Coin                        xmlparsing(3)
2
3
4

NAME

6       xmlparsing - XML Parsing with Coin
7
8       For Coin 3.0, we added an XML parser to Coin. This document describes
9       how it can be used for generic purposes.
10
11       Why another XML parser, you might ask? First of all, the XML parser is
12       actually a third-party parser, expat. Coin needed one, and many Coin-
13       dependent projects needed one as well. We therefore needed to expose an
14       API for it. However, integrating a 3rd-party parser into Coin, we can
15       not expose its API directly, or other projects also using Expat would
16       get conflicts. We therefore needed to expose the XML API with a unique
17       API, hence the API you see here. It is based on a XML DOM API we use(d)
18       in a couple of other projects, but it has been tweaked to fit into Coin
19       and to be wrapped over Expat (the original implementation just used
20       flex).
21
22       The XML parser is both a streaming parser and a DOM parser. Being a
23       streaming parser means that documents can be read in without having to
24       be fully contained in memory. When used as a DOM parser, the whole
25       document is fully parsed in first, and then inspected by client code by
26       traversing the DOM. The two modes can actually be mixed arbitrarily if
27       ending up with a partial DOM sounds useful.
28
29       The XML parser has both a C API and a C++ API. The C++ API is just a
30       wrapper around the C API, and only serves as convenience if you prefer
31       to read/write C++ code (which is tighter) over more verbose C code.
32
33       The C API naming convention may look a bit strange, unless you have
34       written libraries to be wrapped for scheme/lisp-like languages before.
35       Then you might be familiar with the convention of suffixing your
36       functions based on their behaviour/usage meaning. Mutating functions
37       are suffixed with '!', or '_x' for (eXclamation point), and predicates
38       are suffixed with '?', or '_p' in C.
39
40       The simplest way to use the XML parser is to just call
41       cc_xml_read_file(filename) and then traverse the DOM model through
42       using cc_xml_doc_get_root(), cc_xml_elt_get_child(), and
43       cc_xml_elt_get_attr().
44
45       See also
46           XML related functions and objects, cc_xml_doc, cc_xml_elt,
47           cc_xml_attr
48
49Version 4.0.0              Wed Jul 19 2023 00:00:00              xmlparsing(3)
Impressum