[
Lists Home |
Date Index |
Thread Index
]
At 7:49 PM -0500 10/27/03, Gerald Bauer wrote:
> Now let's look what a button looks like in the
>"revolutionary" Microsoft XAML thingy:
>
> <Button Background="LightSeaGreen" FontSize="24pt">
> Calculate
> </Button>
>
> Whow. Compared to the XUL version:
>
> <button label="Calculate" style="background:
>lightSeaGreen; font-size: 24pt" />
Hmm. To me it looks like XAML is considerably better designed than
XUL. This is very much like the difference between SVG and XSL-FO
that I wrote about in Item 11 of Effective XML, Make structure
explicit through markup. XUL is using a double syntax with embedded
CSS. The syntax should be XML, even if the semantics come from CSS.
XAML and XSL-FO get this right. XUL and SVG get this wrong. I've now
put that chapter online:
http://www.cafeconleche.org/books/effectivexml/chapters/11.html
I think someone asked if it would be possible to write an XSLT
stylesheet to convert from XAML to XUL. One consequence of XUL's
design is that it is much easier to write a stylesheet to go from
XAML to XUL than from XUL to XAML. XAML-->XUL is straightforward
because all the important XAML structures are marked up in XML.
XUL-->XAML requires writing a CSS parser in XSLT, doable but ugly and
hard.
The use of a potentially structured label is also a decided
improvement in XAML, as I wrote about in Item 12 of Effective XML,
Store metadata in attributes. XUL's approach is decidedly limited. It
can't easily be extended to make a label anything other than plain
text. I've put that chapter online too:
http://www.cafeconleche.org/books/effectivexml/chapters/12.html
Of course, I'm basing all of this on just one example, so it's
possible there are other issues here. And XAML may be making mistakes
too. Petzold's article suggests that it's misusing CDATA sections in
violation of Item 15, Build on top of structures, not syntax. "Any
programming code in an XAML file must be enclosed in a CDATA section.
" However, there I strongly suspect it's just Petzold's inexperience
with markup causing him to make false statements rather than an
underlying problem with XAML.
Either way, this is an instructive example of the right and wrong way
to use markup. For a change, it looks like Microsoft is the one doing
it right.
--
Elliotte Rusty Harold
elharo@metalab.unc.edu
Processing XML with Java (Addison-Wesley, 2002)
http://www.cafeconleche.org/books/xmljava
http://www.amazon.com/exec/obidos/ISBN%3D0201771861/cafeaulaitA
|