New XML parser written for D1 and D2.

Justin Johansson no at spam.com
Wed Oct 14 17:04:45 PDT 2009


Andrei Alexandrescu Wrote:

> Saaa wrote:
> > Michael Rynn wrote
> >> Where and to whom can I post the 56 KB source code zip?
> > Attaching it to an enhancement in bugzilla would be best, I think. 
> 
> Yes please. Making the code work with ranges as input would be great.
> 
> Andrei

Hi Andrei,

Still being a D apprentice and not 100% conversant with D terminology yet, I assume,
and not wanting to make an *ass* out of *u* and *me* :-),
that by "ranges" you mean making use of D sub char[] arrays over the input so as to
minimize/obviate the need to allocate lots of small(er) strings to hold element tagnames,
attribute names and values, text node contents and so on.

This assumption being correct, can you confirm or otherwise that the consequence of such
a design would mean that by parsing, say, a 1MB XML in-memory document, constructing a
node tree from the same and having the nodes directly referencing substrings in the input document via string "ranges", the entire 1MB would be locked into memory by the GC and not
collectable until the node tree itself is done with?

Now I might be completely off track;  perhaps instead you are thinking of SAX style
parsing and passing arguments to the SAX event handling function via the said ranges.  In
this scenario I guess the SAX client could decide whether or not to .dup the ranges.

Depending on your clarification, I may have further comment based upon my practical
experience in the XML domain.

Regards

Justin Johansson






More information about the Digitalmars-d mailing list