Status of std.xml (D2/Phobos)

Steven Schveighoffer schveiguy at yahoo.com
Mon Jun 28 07:11:12 PDT 2010


On Mon, 28 Jun 2010 09:59:45 -0400, Alix Pexton  
<alix.DOT.pexton at gmail.dot.com> wrote:

>
> I've never used anything like SAX myself, though I have used the DOM  
> quite a lot, and spent most of the time wishing it worked a bit more  
> like StAX (even though I hadn't heard of StAX at the time ^^).

DOM is usually built on top of SAX, so start with the lowest common  
denominator.

> What ever is done for D, it should allow programmers to work with XML in  
> a way that is familiar to them and compatible with what others do.  
> Memory should be used conservatively, and reprocessing (parsing the same  
> portion of a document multiple times) should be minimised.

Parsing multiple times should be minimized, but more important than that,  
allocations should be minimal.  Nothing kills a good parsing/input  
algorithm's performance in D than overuse of the GC.  Tango goes as far as  
having you pass in stack buffers to avoid even allocating buffers (not  
sure about it's xml lib, but knowing the rest of the lib, probably), I  
don't think std.xml has to go that far.

> Most importantly, the implementation should be D-ey, rather that the  
> abstraction used in any other language's most favoured solution,  
> shoehorned into a D-shaped box.

Yes, I don't think the phobos solution needs to mimic exactly the API of  
SAX or DOM, the author should be free to use D idioms.  But starting with  
a common proven design is probably a good idea.

-Steve


More information about the Digitalmars-d mailing list