The XML module in Phobos

Benji Smith dlanguage at benjismith.net
Thu Jul 30 19:42:29 PDT 2009


> Michael Rynn wrote:
>> I did look at the code for the xml module, and posted a suggested bug
>> fix to the empty elements problem. I do not have access rights to
>> updating the source repository, and at the time was too busy for this.

Andrei Alexandrescu wrote:
> It would be great if you could contribute to Phobos. Two things I hope 
> from any replacement (a) works with ranges and ideally outputs ranges, 
> (b) uses alias functions instead of delegates if necessary.

Interesting. Most XML parsers either produce a "Document" object, or 
they just execute SAX callbacks. If an XML parser returned a range 
object, how would you use it?

Usually, I use something like XPath to extract information from an XML 
doc. Something liek this:

    auto doc = parser.parse(xml);
    auto nodes = doc.select("/root//whatever[0][@id]");

I can see how you might do depth-first or breadth-first traversal of the 
DOM tree, or inorder traversal of the SAX events, with a range. But 
that's now how most people use XML. Are there are other range tricks up 
your sleeve that would support the a DOM or XPath kind of model?

--benji



More information about the Digitalmars-d mailing list