Hi,

  Groovy a new dynamic scripting language for the Java
runtime cooked up by James Strachan (of Geronimo,
Jelly, dom4j and more fame) and Bob McWhirter (of
Jaxen, dom4j, codehaus and more fame) that lets you do
more with less now also tries to fix up XML using the
headline "TreeBasedSyntax".

  James writes on the Groovy TreeBasedSyntax Wiki
page:

  We have native syntax support for List and Maps. We
should also support arbitrary nested tree structures.
e.g. DOMish APIs or Ant tasks or Jelly tags or Swing
widgets or whatever. Each may have their own
particular factory mechanism to create the tree of
objects - however they can share the same markup
syntax to define them - in a concise alternative to
XML.

  In general we'd like to support a few kinds of
markup...

* generic tree structures (making groovy.lang.Node a
first class syntax like Map and List are)
* custom tree structures (beans, DOMs, Swing, Ant,
Jelly etc)
* metadata (JDK 1.5 style) 


  Now James is not all talk but also wipes up some
examples that already work with the latest Groovy CVS
snapshot:

f = frame(size:[300,300], text:'My Window') {
    label(bounds:[10,10,290,30], text:'Save changes')
    panel(bounds:[10,40,290,290]) {
        button(text:'OK', action:{ save(); close() })
        button(text:'Cancel', action:{ close() })
    }
}


 James also shows off how you can mix scripting with
markup:

f = frame(text: calculateFieldName(foo, 1234))

    // lets iterate through some map
    map = [1:"hello", 2:"there"]

    for e in map {
      label(name:e.value)
      textfield(name:e.value)
    }
}
    
  Full story @
http://wiki.codehaus.org/groovy/TreeBasedSyntax

  - Gerald

PS: For more info about Groovy, check out the Java
Republic stories titled "Groovy - Jazzing Up Plain Old
Java" online @
http://viva.sourceforge.net/republic/2003/09/groovy_jazzing_up_plain_old_java.html
and "Groovy: Making Java More Funky" online @ 
http://viva.sourceforge.net/republic/2003/10/groovy_making_java_more_funky.html


-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
Does SourceForge.net help you be more productive?  Does it
help you create better code?   SHARE THE LOVE, and help us help
YOU!  Click Here: http://sourceforge.net/donate/
_______________________________________________
xul-announce mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xul-announce

Reply via email to