Lists Home |
Date Index |
> From: Miles Sabin [mailto:email@example.com]
> [regarding these examples:
> Can you, in all honesty, say that the latter is cleaner, more
> consistent and less confusing than the former?
I can :) There's only one programming language to deal with in the XOM
example. The former has Java with XPath 'macros'. And at the back of
both is the XHTML, which is the domain language we're interested in.
Fwiw, I don't see *either* of these as that desirable to program in (but
probably better than what I'm already using). By the looks of things,
the problem seems to be in Java itself, not anyone's particular
You can shorten the verbose XOM version a bit, if you don't mind
Element head = new Element("head")
.add(new Attribute("rel", "stylesheet"))
.add(new Attribute("type", "text/css"))
.add(new Attribute("href", "/ss/style.css")));
Element body = new Element("body")
Element html = new Element("html")
(why type "appendChild", when I can just type "add"?).
At this point, we might as well give in and use Lisp, being a natural
fit for manipulating syntax trees. As for InnerXML, it looks like Lisp's
Bill de hÓra