New XML parser written for D1 and D2.

Justin Johansson no at spam.com
Wed Oct 14 17:39:44 PDT 2009


Jeremie Pelletier Wrote:

> He meant range structs as found in std.range and their array wrappers in 
> std.array.

Oh, okay.  Just groked src and looks like it is a D2 only thing.  Do you happen to know
what the derivation of the word "range" with respect to streams is?  I haven't come
across it before used in this context.

> A range is D's version of streams, so for example a simple reader might 
> look like:
> 
> void read(T)(in T range) if(isInputRange!T) {
> 	while(!range.empty()) {
> 		auto elem = range.front();
> 		// process element
> 		range.popFront();
> 	}
> }
 
> I think you confuse ranges with slices. Ranges are simply an interface 
> for sequential or random data access. DOM trees and SAX callbacks are 
> different methods of parsing the xml, a range is a method of accessing 
> the data :)

Yes seems that way; my question apparently asked upon D1 knowledge only.

Re SAX, it easy enough to get James Clark's Expat 'C' parser happening with D.
That has an event-based API.  Perhaps all the std D library needs do is wrap this.
Whilst it's open source, dunno about the specific licensing issues though.

-- JJ




More information about the Digitalmars-d mailing list