xmlparsing(3)
β¨ xmlparsing β¨
okay bestie, buckle up β this is the xmlparsing page from the Library Functions Manual, aka XML Parsing with Coin π and it's lowkey iconic.
So for Coin 3.0, we added an XML parser to Coin, and this doc is literally here to tell you how to use it for generic purposes. π
π NAME π
xmlparsing β XML Parsing with Coin
okay so, for Coin 3.0, we added an XML parser to Coin. This document describes how it can be used for generic purposes. π«Ά
Now, "why another XML parser" you might ask? bestie, valid question, and the tea is: first of all, the XML parser is actually a third-party parser, expat. Coin needed one, and so did a whole bunch of Coin-dependent projects, so we needed to expose an API for it. but β and this is the plot twist β integrating a 3rd-party parser into Coin means we can't expose its API directly, because otherwise other projects also using Expat would get conflicts π. So we needed to expose the XML API with a unique API, hence the API you see here. It's based on an XML DOM API we use(d) in a couple of other projects, but it's been tweaked to fit into Coin and to be wrapped over Expat (the original implementation just used flex). slay.
The XML parser is both a streaming parser and a DOM parser. β¨
- Being a streaming parser means that documents can be read in without having to be fully contained in memory. iconic.
- When used as a DOM parser, the whole document is fully parsed in first, and then inspected by client code by traversing the DOM.
And the two modes can actually be mixed arbitrarily if ending up with a partial DOM sounds useful. main character energy fr fr π
The XML parser has both a C API and a C++ API. The C++ API is just a wrapper around the C API, and only serves as convenience if you prefer to read/write C++ code (which is tighter) over more verbose C code. π¦
The C API naming convention may look a bit strange, unless you've written libraries to be wrapped for scheme/lisp-like languages before. Then you might be familiar with the convention of suffixing your functions based on their behaviour/usage meaning. π§
- Mutating functions are suffixed with
"!", or"_x"for (eXclamation point). - Predicates are suffixed with
"?", or"_p"in C.
ngl if that sounds weird at first, that's just the vibe check of wrapped-library naming. iykyk π
The simplest way to use the XML parser is to just call cc_xml_read_file(filename) and then traverse the DOM model through using cc_xml_doc_get_root(), cc_xml_elt_get_child(), and cc_xml_elt_get_attr(). no cap, that's it. πΈ
π SEE ALSO π
- XML related functions and objects
cc_xml_doccc_xml_eltcc_xml_attr
and that's a wrap, bestie π this whole page is Coin, Version 3.1.3, and it's filed under xmlparsing(3). go parse something pretty πβ¨π¦
π¦ where this page comes from
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 43: Coin3-devel 3.1.3-40.fc43 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- fedora 44: Coin3-devel 3.1.3-42.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms