GSoC 2016 - std.experimental.xml after a month

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Sat Jun 25 13:16:09 PDT 2016


On 6/25/16 12:26 PM, Lodovico Giaretta wrote:
> On Saturday, 25 June 2016 at 15:59:40 UTC, Jacob Carlborg wrote:
>> Any range API, or plan for?
>
> Hi,
>
> I'm definitely going to provide a wrapper around the Cursor API, that
> will provide InputRange access to all the children of the current node
> (this way the tree structure is maintained). I plan to upload it in a
> couple of days.
>
> I'm still pondering if it's worth providing also a way to get a Range of
> the entire document tree, flattened; it's nodes would be in one-to-one
> correspondence with the events generated by a SAX parser (another API
> which does not preserve the tree structure).

When I had the gumption to try and make an XML parser range, the idea I 
had was to have the current element's tag and attributes, all parent 
elements' tags and attributes, and the currently parsed entity inside 
the element. If the entity you were parsing was an element, you could 
either popFront it, to get to the next element, or descend into it's 
children, and the element and it's attributes would be pushed onto the 
"element" stack.

The idea is to keep all the context alive, but not have to keep the 
entire file in memory.

Anyway, that's how I envisioned it. Haven't finished my i/o package yet, 
so it didn't materialize :)

-Steve


More information about the Digitalmars-d mailing list