[XML-DEV Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message]

Greenspun's tenth law rears its head: was InnerXml is like printf (WAS:

  • To: <xml-dev@l...>
  • Subject: Greenspun's tenth law rears its head: was InnerXml is like printf (WAS: Underwhelmed)
  • From: Bill de hÓra <dehora@a...>
  • Date: Mon, 23 Sep 2002 08:55:08 +0100
  • Importance: Normal
  • Reply-to: <dehora@a...>

greenspun s law

> From: Miles Sabin [mailto:miles@m...]
>
> [regarding these examples:
<http://lists.xml.org/archives/xml-dev/200209/msg00718.html>]
>
> 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
proposal. 

You can shorten the verbose XOM version a bit, if you don't mind
non-idiomatic Java:

  Element head = new Element("head")
   .add(new Element("title)
     .add("Example 3"))
   .add(new Element("link")
     .add(new Attribute("rel", "stylesheet"))
     .add(new Attribute("type", "text/css"))
    .add(new Attribute("href", "/ss/style.css")));

  Element body = new Element("body")
   .add(new Element("p")
     .add("Hello World"));

  Element html = new Element("html")
   .add(head)
   .add(body);

(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
read-from-string function.

Bill de hÓra 
--
Propylon
www.propylon.com 


PURCHASE STYLUS STUDIO ONLINE TODAY!

Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced!

Buy Stylus Studio Now

Download The World's Best XML IDE!

Accelerate XML development with our award-winning XML IDE - Download a free trial today!

Don't miss another message! Subscribe to this list today.
Email
First Name
Last Name
Company
Subscribe in XML format
RSS 2.0
Atom 0.3
 

Stylus Studio has published XML-DEV in RSS and ATOM formats, enabling users to easily subcribe to the list from their preferred news reader application.


Stylus Studio Sponsored Links are added links designed to provide related and additional information to the visitors of this website. they were not included by the author in the initial post. To view the content without the Sponsor Links please click here.

Site Map | Privacy Policy | Terms of Use | Trademarks
Free Stylus Studio XML Training:
W3C Member
Stylus Studio® and DataDirect XQuery ™are products from DataDirect Technologies, is a registered trademark of Progress Software Corporation, in the U.S. and other countries. © 2004-2013 All Rights Reserved.