www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Best XML Library

reply "Meta" <jared771 gmail.com> writes:
I'm thinking of starting on a small XMPP-based messaging client 
and server, which would necessitate quite an extensive use of 
XML. Since Tango is no longer being maintained, and Vibe.d 
doesn't support XML (as far as I know), what would be the best 
option for XML capabilities?
May 23 2013
next sibling parent Timothee Cour <thelastmammoth gmail.com> writes:
what about std.xml for starters ?
it is criticized and in need of overhaul though.

I've used http://vipbase.net/xmlparser/ and I liked it; here's the
description:

XmlParser is a lightweight open source C++ library based on Apache's Xerces
C++ Parser <http://xml.apache.org/xerces-c/>. XmlParser contains only two
files (one .cpp and one .h) and provides simple API for parsing XML files.
XmlParser supports charsets such as GB2312.

it's only 2 files and should be easy to port to D.


On Thu, May 23, 2013 at 3:22 PM, Meta <jared771 gmail.com> wrote:

 I'm thinking of starting on a small XMPP-based messaging client and
 server, which would necessitate quite an extensive use of XML. Since Tango
 is no longer being maintained, and Vibe.d doesn't support XML (as far as I
 know), what would be the best option for XML capabilities?
May 23 2013
prev sibling next sibling parent reply "deadalnix" <deadalnix gmail.com> writes:
On Thursday, 23 May 2013 at 22:22:26 UTC, Meta wrote:
 I'm thinking of starting on a small XMPP-based messaging client 
 and server, which would necessitate quite an extensive use of 
 XML. Since Tango is no longer being maintained, and Vibe.d 
 doesn't support XML (as far as I know), what would be the best 
 option for XML capabilities?
Tango.xml is know to be pretty good. std.xml isn't that great performance and API wize. I know vibe propose something, but I am unsure how good it is.
May 23 2013
parent "Dicebot" <m.strashun gmail.com> writes:
On Friday, 24 May 2013 at 03:04:17 UTC, deadalnix wrote:
 On Thursday, 23 May 2013 at 22:22:26 UTC, Meta wrote:
 I'm thinking of starting on a small XMPP-based messaging 
 client and server, which would necessitate quite an extensive 
 use of XML. Since Tango is no longer being maintained, and 
 Vibe.d doesn't support XML (as far as I know), what would be 
 the best option for XML capabilities?
Tango.xml is know to be pretty good. std.xml isn't that great performance and API wize. I know vibe propose something, but I am unsure how good it is.
Vibe.d don't have XML module, only Json and Bson.
May 24 2013
prev sibling next sibling parent Jacob Carlborg <doob me.com> writes:
On 2013-05-24 00:22, Meta wrote:
 I'm thinking of starting on a small XMPP-based messaging client and
 server, which would necessitate quite an extensive use of XML. Since
 Tango is no longer being maintained, and Vibe.d doesn't support XML (as
 far as I know), what would be the best option for XML capabilities?
The XML package in Tango is the best. Still works even if it's not maintained. It won't compile with the latest beta of DMD but it does compile with the latest version, 2.062. I'll have dependencies on Tango so I'll probably maintained if no one else does it. -- /Jacob Carlborg
May 24 2013
prev sibling next sibling parent reply David <d dav1d.de> writes:
Am 24.05.2013 00:22, schrieb Meta:
 I'm thinking of starting on a small XMPP-based messaging client and
 server, which would necessitate quite an extensive use of XML. Since
 Tango is no longer being maintained, and Vibe.d doesn't support XML (as
 far as I know), what would be the best option for XML capabilities?
I recommend you to look at: http://opticron.no-ip.org/svn/branches/kxml/
May 24 2013
parent "ponce" <contact gam3sfrommars.fr> writes:
On Friday, 24 May 2013 at 11:07:02 UTC, David wrote:
 Am 24.05.2013 00:22, schrieb Meta:
 I'm thinking of starting on a small XMPP-based messaging 
 client and
 server, which would necessitate quite an extensive use of XML. 
 Since
 Tango is no longer being maintained, and Vibe.d doesn't 
 support XML (as
 far as I know), what would be the best option for XML 
 capabilities?
I recommend you to look at: http://opticron.no-ip.org/svn/branches/kxml/
I concur. It works very well for my DOM parser needs. Filtering on XPath makes it very easy to do anything.
May 24 2013
prev sibling next sibling parent reply "Andrea Fontana" <nospam example.com> writes:
On Thursday, 23 May 2013 at 22:22:26 UTC, Meta wrote:
 I'm thinking of starting on a small XMPP-based messaging client 
 and server, which would necessitate quite an extensive use of 
 XML. Since Tango is no longer being maintained, and Vibe.d 
 doesn't support XML (as far as I know), what would be the best 
 option for XML capabilities?
You should give a try to dom.d by adam ruppe: https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff You just need dom.d and charactersencoding.d
May 24 2013
parent reply "Adam D. Ruppe" <destructionator gmail.com> writes:
On Friday, 24 May 2013 at 12:56:54 UTC, Andrea Fontana wrote:
 On Thursday, 23 May 2013 at 22:22:26 UTC, Meta wrote:
 I'm thinking of starting on a small XMPP-based messaging
 You should give a try to dom.d by adam ruppe:
I don't think it would work best for xmpp though because dom.d needs the entire file before it can parse, and xmpp is a stream of data.
May 24 2013
next sibling parent "Steven Schveighoffer" <schveiguy yahoo.com> writes:
On Fri, 24 May 2013 10:18:37 -0400, Adam D. Ruppe  
<destructionator gmail.com> wrote:

 On Friday, 24 May 2013 at 12:56:54 UTC, Andrea Fontana wrote:
 On Thursday, 23 May 2013 at 22:22:26 UTC, Meta wrote:
 I'm thinking of starting on a small XMPP-based messaging
 You should give a try to dom.d by adam ruppe:
I don't think it would work best for xmpp though because dom.d needs the entire file before it can parse, and xmpp is a stream of data.
AFAIK, Tango's xml is the same. -Steve
May 28 2013
prev sibling parent "Adam D. Ruppe" <destructionator gmail.com> writes:
On Friday, 24 May 2013 at 14:18:38 UTC, Adam D. Ruppe wrote:
 I don't think it would work best for xmpp though because dom.d 
 needs the entire file before it can parse, and xmpp is a stream 
 of data.
I just decided to write a quick stream like thing, to see if I can, and it actually kinda works. My dom.d is still NOT an ideal choice for xmpp, I was just wondering if I could do this easily and figured I'd share the results. dom.d https://github.com/adamdruppe/misc-stuff-including-D-programming-language-web-stuff/blob/master/dom.d also needs characterencodings.d from that same github. === import arsd.dom; import std.stdio; void main() { auto document = new Document(); document.eventObservers ~= delegate(DomMutationEvent event) { if(event.operation == DomMutationOperations.appendChild) { auto element = event.related; if(element.tagName == "cool") writeln("GOT: " ~ element.toString()); } }; document.parseStream(new Utf8Stream(delegate string() { return readln(); }, delegate bool() { return stdin.isOpen; }), true, true); } === $ dmd streamtest.d dom.d characterencodings.d <test> <cool>sweet</cool> </test> The parse function expected a complete string, and I didn't signficantly modify it. Instead I created a class Utf8Stream that overloads enough operators that it can pretend to be a string, but one that can fetch more data when its length is checked and it is close to the last index fetched (the parse function checks data.length often to avoid going out of bounds, and it fetches chars by opIndex one at a time, so it works here, but wouldn't likely work elsewhere. Heck it might even break with non-ascii input, I haven't tried that yet) So yeah pretty hacky, but since it internally builds the tree and fires off these mutation event things, you can hook into that and react as it is built, accomplishing the task at hand, more or less. But since it is still building a big old dom and appending strings internally, it will be a bit of a memory hog as time goes on, and performance may not be great. It also works better in strict mode (The true, true on the parse function argument list does this) than garbage mode when streaming. Like I said, dom.d still isn't my first choice for xmpp or any other enormous xml parsing task, but hey it kinda works and is fairly convenient so if this looks useful to you, have fun!
May 28 2013
prev sibling next sibling parent reply "Idan Arye" <GenericNPC gmail.com> writes:
On Thursday, 23 May 2013 at 22:22:26 UTC, Meta wrote:
 I'm thinking of starting on a small XMPP-based messaging client 
 and server, which would necessitate quite an extensive use of 
 XML. Since Tango is no longer being maintained, and Vibe.d 
 doesn't support XML (as far as I know), what would be the best 
 option for XML capabilities?
I suggest you check the XMLP library by Michael Rynn. I tried XML processing with D, so I don't know how good the different libraries are, but XMLP is on the review queue, which means it's highly possible it will become Phobos' standard XML library, and when that happens you will have an easy migration.
May 24 2013
parent "Meta" <zxc tgb.com> writes:
 I suggest you check the XMLP library by Michael Rynn. I tried 
 XML processing with D, so I don't know how good the different 
 libraries are, but XMLP is on the review queue, which means 
 it's highly possible it will become Phobos' standard XML 
 library, and when that happens you will have an easy migration.
That is a good point. I suppose I'll take a look at that and Tango's XML package.
May 25 2013
prev sibling next sibling parent "michaelc37" <michaelc37 msn.com> writes:
On Thursday, 23 May 2013 at 22:22:26 UTC, Meta wrote:
 I'm thinking of starting on a small XMPP-based messaging client 
 and server, which would necessitate quite an extensive use of 
 XML. Since Tango is no longer being maintained, and Vibe.d 
 doesn't support XML (as far as I know), what would be the best 
 option for XML capabilities?
Some time ago, I contacted the xmlp developers about this type of parsing. They made some changes and shared these links with me. http://bazaar.launchpad.net/~michael-rynn-500/d2-xml/d2-xml-dev/view/head:/alt/jabber.d http://bazaar.launchpad.net/~michael-rynn-500/d2-xml/d2-xml-dev/view/head:/test/jclient.d http://bazaar.launchpad.net/~michael-rynn-500/d2-xml/d2-xml-dev/view/head:/test/jserver.d
Jun 13 2013
prev sibling parent reply "qznc" <qznc web.de> writes:
On Thursday, 23 May 2013 at 22:22:26 UTC, Meta wrote:
 I'm thinking of starting on a small XMPP-based messaging client 
 and server, which would necessitate quite an extensive use of 
 XML. Since Tango is no longer being maintained, and Vibe.d 
 doesn't support XML (as far as I know), what would be the best 
 option for XML capabilities?
Additional requirement: You need a streaming XML parser (aka event-based or SAX). Is it Open Source? I was thinking about doing something similar.
Jun 14 2013
parent Jacob Carlborg <doob me.com> writes:
On 2013-06-14 10:49, qznc wrote:

 Additional requirement: You need a streaming XML parser (aka event-based
 or SAX).
Tango has a SAX parser.
 Is it Open Source? I was thinking about doing something similar.
-- /Jacob Carlborg
Jun 14 2013