wwtxt 1.11 review
DownloadParsing XML and CSS data is rather simple, but most libraries that aim for this simple goal are bloated with a whole lot of other irr
|
|
Parsing XML and CSS data is rather simple, but most libraries that aim for this simple goal are bloated with a whole lot of other irrelevant additions.
The wwtxt library is a very minimalistic library containing just the required parsers (and therefore considerably smaller than for instance libxml; by a factor 40 or so). wwtxt library relies on tree.hh for the storage classes.
This library only parses well-formed XML and CSS; it throws an exception when it is fed other input. If you want to feed it HTML or any of the other stuff that people call HTML, run it through the tidy tool, with the options
tidy --add-xml-decl yes --add-xml-space yes --output-xml yes --force-output yes
--show-warnings no --quiet yes --show-errors 0
(which you can put in a configuration file too, see the tidy documentation).
Sample uses
Reading in an XML document, walking through the tree and converting a tree back to an XML document are all extremely simple. To read an XML document from std::cin and write it back to std::cout with nicely indented output, all that is needed is
#include < iostream >
#include < wwtxt/xml.hh >
int main(int, char **)
{
xml::document doc;
xml::parser parser(doc);
while(std::cin)
std::cin >> parser;
std::cout
wwtxt 1.11 keywords