What xml libraries are people using?
Adam D. Ruppe
destructionator at gmail.com
Sat Mar 2 07:11:45 PST 2013
I use the dom.d in the long misc github link. (I wrote it for
myself)
I find it very convenient but there are some downsides:
1) it is slow with large files
2) it eats a lot of memory, I think about 150 bytes per node,
plus the actual data (text and attributes). A 1 MB xml file can
easily eat 10 MB of ram.
3) it isn't very well documented, but if you've used javascript
dom, most your knowledge can carry over.
So if you're working with a lot of data, you don't want to use it.
But if you're using smaller files and want a lot of convenience
with stuff like css selectors and convenience functions, or want
to deal with poorly written html, it is something you can try.
It requires the files dom.d and characterencodings.d from my
github.
To parse xml while checking for well formedness and utf-8:
auto document = new Document();
document.parse(strXml, true, true);
To parse html while correcting for tags soup and wrong character
encodings:
auto document = new Document();
document.parseGarbage(strHtml);
More information about the Digitalmars-d-learn
mailing list