Learning to XML with D

Derix via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Feb 6 01:15:50 PST 2015


So, I set sails to transform a bunch of HTML files with D. This, 
of course, will happen with the std.xml library.

There is this nice example :
http://dlang.org/phobos/std_xml.html#.DocumentParser
that I put to some use already, however some of the basics seem 
to escape me, specially in lines like

     xml.onEndTag["author"]       = (in Element e) { book.author   
    = e.text(); };

OK, we're doing some event-base parsing, reacting with a lambda 
function on encountering so-and-do tag, à la SAX. (are we ?)

What I don't quite grab is the construct (in Element e) , 
especially the *in* part.

Is it *in* as in http://dlang.org/expression.html#InExpression ? 
In which case I fail to see what associative array we're 
considering.

It's probably more a way to further qualify the argument e were 
passing to the  λ-function : could someone elaborate on that ?

Of course, it is entirely possible that I completely miss the 
point and that I'm overlooking some fundamentals, if so have 
mercy and help me find my way back to teh righteous path ;-)


Thxxx


More information about the Digitalmars-d-learn mailing list