On Friday, 6 February 2015 at 09:15:54 UTC, Derix wrote:
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

The documentation says:

"Warning: This module is considered out-dated and not up to Phobos' current standards. It will remain until we have a suitable replacement, but be aware that it will not remain long term."

My advice is not to use it. I used it a while back, but it slowed down my system (why I still don't know), and it is permanently soon-to-be deprecated.

If you wanna use D for XML parsing, see if you can find a solid 3rd party library in D (have a look at Adam's github page: https://github.com/adamdruppe/, he has some DOM and HTML stuff up there).

There is a new xml module in the review queue, but nobody seems to care. I _think_ the reason why nobody really cares is that most people in the D community don't like XML.

Reply via email to