|
Griffon 0.9.5-rc2 | |||||||
FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectgriffon.util.Xml2Groovy
public final class Xml2Groovy extends Object
Translates an XML file into a Groovy script that is suitable for a Groovy builder. String literals must be escaped either using single or double quotes.
This helper class is useful for translating an XML View definition into a Groovy script that can be handled by an UberBuilder, for example this View
application(title: app.config.application.title, pack: true) { actions { action(id: 'clickAction', name: 'Click', closure: {controller.click(it)}) } gridLayout(cols: 1, rows: 3) textField(id: 'input', text: bind('value', target: model), columns: 20) textField(id: 'output', text: bind{model.value}, columns: 20, editable: false) button(action: clickAction) }
Field Summary | |
---|---|
private static Xml2Groovy |
INSTANCE
|
Constructor Summary | |
private Xml2Groovy()
|
Method Summary | |
---|---|
private IndentPrinter
|
createIndentPrinter(OutputStream os)
|
static Xml2Groovy
|
getInstance()
|
private XmlSlurper
|
newXmlSlurper()
|
String
|
parse(File file)
|
String
|
parse(InputSource source)
|
String
|
parse(InputStream stream)
|
String
|
parse(Reader reader)
|
String
|
parse(String uri)
|
String
|
parse(GPathResult root)
|
String
|
parseText(String text)
|
private String
|
translate(GPathResult root)
|
private void
|
walkXml(IndentPrinter printer, NodeChild node)
|
private void
|
walkXml(IndentPrinter printer, Node node)
|
Methods inherited from class Object | |
---|---|
wait, wait, wait, equals, toString, hashCode, getClass, notify, notifyAll |
Field Detail |
---|
private static final Xml2Groovy INSTANCE
Constructor Detail |
---|
private Xml2Groovy()
Method Detail |
---|
private IndentPrinter createIndentPrinter(OutputStream os)
public static Xml2Groovy getInstance()
private XmlSlurper newXmlSlurper()
public String parse(File file)
public String parse(InputSource source)
public String parse(InputStream stream)
public String parse(Reader reader)
public String parse(String uri)
public String parse(GPathResult root)
public String parseText(String text)
private String translate(GPathResult root)
private void walkXml(IndentPrinter printer, NodeChild node)
private void walkXml(IndentPrinter printer, Node node)
Groovy Documentation