Jump to page: 1 2
Thread overview
What xml libraries are people using?
Mar 02, 2013
simendsjo
Mar 02, 2013
Dicebot
Mar 02, 2013
Adam D. Ruppe
Mar 02, 2013
Russel Winder
Mar 02, 2013
Jacob Carlborg
Mar 02, 2013
Jesse Phillips
Mar 04, 2013
Brad Roberts
Mar 06, 2013
Jesse Phillips
Mar 02, 2013
Andrej Mitrovic
Mar 04, 2013
timotheecour
May 24, 2013
Gary Willoughby
Mar 04, 2013
Timothee Cour
May 24, 2013
Benjamin Thaut
March 02, 2013
Everyone says "Don't use std.xml", and there are several other libraries.
Which can you recommend? (I haven't looked closely at any of them, just some links found by googling)

https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/dom.d
http://svn.dsource.org/projects/xmlp/trunk/std/
https://github.com/theredhead/red.xml
https://github.com/opticron/kxml
https://github.com/opticron/libdxml2
https://launchpad.net/d2-xml
March 02, 2013
On Saturday, 2 March 2013 at 08:03:08 UTC, simendsjo wrote:
> Everyone says "Don't use std.xml", and there are several other libraries.
> Which can you recommend? (I haven't looked closely at any of them, just some links found by googling)
>
> https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/dom.d
> http://svn.dsource.org/projects/xmlp/trunk/std/
> https://github.com/theredhead/red.xml
> https://github.com/opticron/kxml
> https://github.com/opticron/libdxml2
> https://launchpad.net/d2-xml

http://wiki.dlang.org/Review_Queue
notice std.xml2 there and its "ready for comments"
March 02, 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);
March 02, 2013
On 2013-03-02 09:03, simendsjo wrote:
> Everyone says "Don't use std.xml", and there are several other libraries.
> Which can you recommend? (I haven't looked closely at any of them, just
> some links found by googling)
>
> https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/dom.d
>
> http://svn.dsource.org/projects/xmlp/trunk/std/
> https://github.com/theredhead/red.xml
> https://github.com/opticron/kxml
> https://github.com/opticron/libdxml2
> https://launchpad.net/d2-xml

The one in Tango:

Docs: http://dsource.org/projects/tango/docs/current/
Tango-D2: https://github.com/SiegeLord/Tango-D2

It's damn fast.

-- 
/Jacob Carlborg
March 02, 2013
I don't do XML working with D, but with Python. Actually I'd prefer never to have to work with XML at all but,…

After many different Python oriented (either Python implemented or C coded Python extensions), the tide has now turned to simply using libxml2 and libxslt using an adaptor library, lxml.

I am assuming if I did do XML work in D, I would connect to these same libraries just as Python does.

-- 
Russel. ============================================================================= Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.winder@ekiga.net 41 Buckmaster Road    m: +44 7770 465 077   xmpp: russel@winder.org.uk London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder


March 02, 2013
On Saturday, 2 March 2013 at 08:03:08 UTC, simendsjo wrote:
> Everyone says "Don't use std.xml", and there are several other libraries.
> Which can you recommend? (I haven't looked closely at any of them, just some links found by googling)
>
> https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/dom.d
> http://svn.dsource.org/projects/xmlp/trunk/std/
> https://github.com/theredhead/red.xml
> https://github.com/opticron/kxml
> https://github.com/opticron/libdxml2
> https://launchpad.net/d2-xml

I use xmlp, aka d2-xml, aka std.xml2 on Review Queue
http://wiki.dlang.org/Review_Queue

Source: https://launchpad.net/d2-xml

XML is pretty complex so I hope more people try and use so that we can get a nice library into Phobos that will appeal to most people.

I don't see Michael Rynn too much on the forms, but he's been pretty receptive when I email him.
March 02, 2013
On 3/2/13, simendsjo <simendsjo@gmail.com> wrote:
> Which can you recommend?

I use ae's lite xml library:

https://github.com/CyberShadow/ae/blob/master/utils/xmllite.d

It's not a monster but thanks to UFCS I can easily extend it to do what I want. For some trivial xml parsing which I needed it was great (OTOH std.xml is a segfaulting monster).
March 04, 2013
On Saturday, 2 March 2013 at 18:42:13 UTC, Andrej Mitrovic wrote:
> On 3/2/13, simendsjo <simendsjo@gmail.com> wrote:
>> Which can you recommend?
>
> I use ae's lite xml library:
>
> https://github.com/CyberShadow/ae/blob/master/utils/xmllite.d
>
> It's not a monster but thanks to UFCS I can easily extend it to do
> what I want. For some trivial xml parsing which I needed it was great
> (OTOH std.xml is a segfaulting monster).


I've used xmlparser, "a lightweight C++ library for parsing xml files", which was indeed fast and lightweight.
http://vipbase.net/xmlparser/
someone would need to port it to D though, but shouldn't be too hard as the library is indeed small.
March 04, 2013
I've used xmlparser, "a lightweight C++ library for parsing xml files", which was indeed fast and lightweight.
http://vipbase.net/xmlparser/
someone would need to port it to D though, but shouldn't be too hard as the library is indeed small.


On Mar 2, 2013, at 10:42 AM, Andrej Mitrovic <andrej.mitrovich@gmail.com> wrote:

> On 3/2/13, simendsjo <simendsjo@gmail.com> wrote:
>> Which can you recommend?
> 
> I use ae's lite xml library:
> 
> https://github.com/CyberShadow/ae/blob/master/utils/xmllite.d
> 
> It's not a monster but thanks to UFCS I can easily extend it to do what I want. For some trivial xml parsing which I needed it was great (OTOH std.xml is a segfaulting monster).



March 04, 2013
On Sat, 2 Mar 2013, Jesse Phillips wrote:
> On Saturday, 2 March 2013 at 08:03:08 UTC, simendsjo wrote:
> > Everyone says "Don't use std.xml", and there are several other libraries. Which can you recommend? (I haven't looked closely at any of them, just some links found by googling)
> > 
> > https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/dom.d
> > http://svn.dsource.org/projects/xmlp/trunk/std/
> > https://github.com/theredhead/red.xml
> > https://github.com/opticron/kxml
> > https://github.com/opticron/libdxml2
> > https://launchpad.net/d2-xml
> 
> I use xmlp, aka d2-xml, aka std.xml2 on Review Queue http://wiki.dlang.org/Review_Queue
> 
> Source: https://launchpad.net/d2-xml
> 
> XML is pretty complex so I hope more people try and use so that we can get a nice library into Phobos that will appeal to most people.
> 
> I don't see Michael Rynn too much on the forms, but he's been pretty receptive when I email him.

Has this implementation been bounced off the w3c xml test suite?
« First   ‹ Prev
1 2