Hello,

  John Gossman writes in the blog story titled
"Working on a XAML parser":

  The past few weeks I've been hard at work on a XAML
parser and serializer.   Now Marc Clifton has shown
you can implement a XAML parser in 300 lines of code,
so you may wonder why it's taking me so long.

  Well, my colleague Chuck and I are working on a
source code preserving system.  Read XAML in, change
the object graph, write it back out and we change as
little source as possible:  comments and whitespace
etc. are preserved.  This too wouldn't be hard if we
did the editing against an XML-style DOM, but we doing
editing against the live (Avalon) objects, and the
system has to work for objects we don't know about and
who don't know about source code preservation. 

Sunday I implemented the compact syntax parser.  For
example, in XAML you can say:

<TransformDecorator Child="*Button(Content=Hello
World;Width=100)" />
instead of:
<TransformDecorator>
    <Button Width="100">
       Hello World
    </Button>
</TransformDecorator>

Please, don't use this syntax for an example like
this. I see its usefulness for *Bind and *Alias, but
in cases like above it simply provides two ways to do
the same thing, one standard XML and one custom.   If
you need further incentive, I am advocating dropping
the compact syntax before Avalon ships...and I'm
fairly confident of success.

Anyway, the parser wasn't that tricky.  I wrote a
scanner that returned a set of tokens:  the type is
the first token, followed by name-value pairs.  Given
the type and the name-value pairs I could reuse the
code that parses normal XAML element/attribute sets to
create our model.  Next up is Style parsing.  That's
pretty much the last thing between us and complete
XAML support. 


  Source:
http://weblogs.asp.net/johngossman/archive/2005/01/25/360224.aspx

  What's your take? Do you think Microsoft should
follow the MyXAML lead and drop the compact syntax?

  - Gerald


-------------------------------------------------------
This SF.Net email is sponsored by: IntelliVIEW -- Interactive Reporting
Tool for open source databases. Create drag-&-drop reports. Save time
by over 75%! Publish reports on the web. Export to DOC, XLS, RTF, etc.
Download a FREE copy at http://www.intelliview.com/go/osdn_nl
_______________________________________________
xul-talk mailing list
xul-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xul-talk

Reply via email to