README.xml 2.0 KB

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