What is the preferred library for parsing XML data in Pure C?
6 Answers
The canonical XML parsing library for C is libxml2.
1 Comment
Here is a list of libraries for multiple languages, including C:
Comments
Not 'the preferred library', but there's also http://www.minixml.org/.
Mini-XML is a small XML library that you can use to read and write XML and XML-like data files in your application without requiring large non-standard libraries. Mini-XML only requires an ANSI C compatible compiler (GCC works, as do most vendors' ANSI C compilers) and a 'make' program.
Mini-XML supports reading of UTF-8 and UTF-16 and writing of UTF-8 encoded XML files and strings. Data is stored in a linked-list tree structure, preserving the XML data hierarchy, and arbitrary element names, attributes, and attribute values are supported with no preset limits, just available memory.
Comments
You can consider miniML-Parser, a simple and tiny XML parser library in C. It is specifically developed for embedded applications in mind.
- It is extremely easy to use: You need to call only one API to parse your XML data
- It has a very small footprint: The parser uses only 1.8 kB1 of code memory. Hence, you can use it in very small embedded applications.
- It is a validating XML parser.
- It also extracts the content of XML data and converts it to its specified data type.
- It comes with a tool to generate the source code from XML schema file, instead of manually writing XML tree structure in C.
Disclosure: I'm author of this miniML-Parser
Comments
VTD-XML is the one you should look into, if you want a combination of ease of use, performane and efficiency