[
Lists Home |
Date Index |
Thread Index
]
Arjun Ray wrote,
> My main concern has always been well-formedness. Validation is an
> extra which I'm willing to forego in some circumstances, e.g. where
> the coders do have familiarity with the vocabulary/ies.
Cool. So take a closer look at my strawman. Using an XPath-derived
string template syntax it ought to be possible to ensure well-
formedness.
InnerXml _is_ printf ... but that doesn't mean we couldn't have
something analogous to printf which has its nice features (domain-
specific little language) without the risk of non-well-formedness.
And that's likely to be a win, even in comparison with,
> hf.aHtml(
> hf.aHead(
> hf.aTitle( "Example 3" )).add(
> hf.aLink( )
> .wRel( "stylesheet" )
> .wType( "text/css" )
> .wHref( new Uri( "/ss/style.css" )))).add(
> hf.aBody(
> hf.aP( "Hello World!" ))).accept( printer ) ;
because we don't have to fight with Java's syntax. How about this
mish-mash of XPath and s-exprs,
Element e =
new Element(
"html/("+
"head/("+
"title/text(%0),"+
"link[@rel='stylesheet',@type='text/css',@uri=%1]),"+
"body/text(%2))",
{ "Example 3", "/ss/style.css", "Hello World" } );
(again assuming concise array literals).
It's not clear to me that an HTML-specific library provides any great
benfits in either safety or readability. And if it supports all of HTML
4.01 it's going to be large ... and obviously applicable only to HTML.
Oh, and BTW: Hungarian notation is an abomination ;-)
Cheers,
Miles
|