README.xml (2082B)
1 XML parser 2 ---------- 3 4 A small XML parser. 5 6 For the original version see: 7 https://git.codemadness.org/xmlparser/ 8 9 10 Dependencies 11 ------------ 12 13 - C compiler (ANSI). 14 15 16 Features 17 -------- 18 19 - Relatively small parser. 20 - Pretty simple API. 21 - Pretty fast. 22 - Portable 23 - No dynamic memory allocation. 24 25 26 Supports 27 -------- 28 29 - Tags in short-form (<img src="lolcat.jpg" title="Meow" />). 30 - Tag attributes. 31 - Short attributes without an explicitly set value (<input type="checkbox" checked />). 32 - Comments 33 - CDATA sections. 34 - Helper function (xml_entitytostr) to convert XML 1.0 / HTML 2.0 named entities 35 and numeric entities to UTF-8. 36 - Reading XML from a fd, string buffer or implement a custom reader: 37 see: XMLParser.getnext or GETNEXT() macro. 38 39 40 Caveats 41 ------- 42 43 - It is not a compliant XML parser. 44 - Performance: data is buffered even if a handler is not set: to make parsing 45 faster change this code from xml.c. 46 - The XML is not checked for errors so it will continue parsing XML data, this 47 is by design. 48 - Internally fixed-size buffers are used, callbacks like XMLParser.xmldata are 49 called multiple times for the same tag if the data size is bigger than the 50 internal buffer size (sizeof(XMLParser.data)). To differentiate between new 51 calls for data you can use the xml*start and xml*end handlers. 52 - It does not handle XML white-space rules for tag data. The raw values 53 including white-space is passed. This is useful in some cases, like for 54 HTML <pre> tags. 55 - The XML specification has no limits on tag and attribute names. For 56 simplicity/sanity sake this XML parser takes some liberties. Tag and 57 attribute names are truncated if they are excessively long. 58 - Entity expansions are not parsed as well as DOCTYPE, ATTLIST etc. 59 60 61 Files used 62 ---------- 63 64 xml.c and xml.h 65 66 67 Interface / API 68 --------------- 69 70 Should be trivial, see xml.c and xml.h and the examples below. 71 72 73 Examples 74 -------- 75 76 sfeed_opml_import.c or sfeed_web.c or sfeed_xmlenc.c 77 78 See skeleton.c in the original xmlparser repository for a base program to start 79 quickly. 80 81 82 License 83 ------- 84 85 ISC, see LICENSE file.