org.codehaus.groovy.tools.xml
Class DomToGroovy
java.lang.Object
org.codehaus.groovy.tools.xml.DomToGroovy
public class DomToGroovy
- extends java.lang.Object
A SAX handler for turning XML into Groovy scripts
Method Summary |
protected boolean |
checkEscaping(java.lang.String localName)
|
protected void |
defineNamespace(java.util.Map namespaces,
java.lang.String prefix,
java.lang.String uri)
|
protected java.util.Map |
defineNamespaces(org.w3c.dom.Element element,
java.util.Map namespaces)
|
protected java.lang.String |
escapeQuote(java.lang.String text)
|
protected java.lang.String |
getAttributeValue(org.w3c.dom.Attr attribute)
|
protected java.lang.String |
getLocalName(org.w3c.dom.Node node)
|
protected java.lang.String |
getTextNodeData(org.w3c.dom.Text node)
|
static void |
main(java.lang.String[] args)
|
protected boolean |
mixedContent(org.w3c.dom.NodeList list)
|
static org.w3c.dom.Document |
parse(java.io.File file)
|
static org.w3c.dom.Document |
parse(java.io.InputStream input)
|
static org.w3c.dom.Document |
parse(java.io.Reader input)
|
protected static org.w3c.dom.Document |
parse(java.lang.String fileName)
|
void |
print(org.w3c.dom.Document document)
|
protected void |
print(org.w3c.dom.Node node,
java.util.Map namespaces,
boolean endWithComma)
|
protected void |
print(java.lang.String text)
|
protected boolean |
printAttributes(org.w3c.dom.Element element)
|
protected boolean |
printAttributeWithoutPrefix(org.w3c.dom.Attr attribute,
boolean hasAttribute)
|
protected void |
printAttributeWithPrefix(org.w3c.dom.Attr attribute,
java.lang.StringBuffer buffer)
|
protected void |
printChildren(org.w3c.dom.Node parent,
java.util.Map namespaces)
|
protected void |
printComment(org.w3c.dom.Comment comment,
boolean endWithComma)
|
protected void |
printElement(org.w3c.dom.Element element,
java.util.Map namespaces,
boolean endWithComma)
|
protected void |
printEnd(java.lang.String text,
boolean endWithComma)
|
protected void |
printIndent()
|
protected void |
println(java.lang.String text)
|
protected void |
printPI(org.w3c.dom.ProcessingInstruction instruction,
boolean endWithComma)
|
protected void |
printQuoted(java.lang.String text)
|
protected void |
printText(org.w3c.dom.Text node,
boolean endWithComma)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
out
protected IndentPrinter out
inMixed
protected boolean inMixed
qt
protected java.lang.String qt
keywords
protected java.util.Collection<java.lang.String> keywords
DomToGroovy
public DomToGroovy(java.io.PrintWriter out)
DomToGroovy
public DomToGroovy(IndentPrinter out)
print
public void print(org.w3c.dom.Document document)
main
public static void main(java.lang.String[] args)
parse
protected static org.w3c.dom.Document parse(java.lang.String fileName)
throws java.lang.Exception
- Throws:
java.lang.Exception
parse
public static org.w3c.dom.Document parse(java.io.File file)
throws java.lang.Exception
- Throws:
java.lang.Exception
parse
public static org.w3c.dom.Document parse(java.io.Reader input)
throws java.lang.Exception
- Throws:
java.lang.Exception
parse
public static org.w3c.dom.Document parse(java.io.InputStream input)
throws java.lang.Exception
- Throws:
java.lang.Exception
print
protected void print(org.w3c.dom.Node node,
java.util.Map namespaces,
boolean endWithComma)
printElement
protected void printElement(org.w3c.dom.Element element,
java.util.Map namespaces,
boolean endWithComma)
printQuoted
protected void printQuoted(java.lang.String text)
printPI
protected void printPI(org.w3c.dom.ProcessingInstruction instruction,
boolean endWithComma)
printComment
protected void printComment(org.w3c.dom.Comment comment,
boolean endWithComma)
printText
protected void printText(org.w3c.dom.Text node,
boolean endWithComma)
escapeQuote
protected java.lang.String escapeQuote(java.lang.String text)
defineNamespaces
protected java.util.Map defineNamespaces(org.w3c.dom.Element element,
java.util.Map namespaces)
defineNamespace
protected void defineNamespace(java.util.Map namespaces,
java.lang.String prefix,
java.lang.String uri)
printAttributes
protected boolean printAttributes(org.w3c.dom.Element element)
printAttributeWithPrefix
protected void printAttributeWithPrefix(org.w3c.dom.Attr attribute,
java.lang.StringBuffer buffer)
getAttributeValue
protected java.lang.String getAttributeValue(org.w3c.dom.Attr attribute)
printAttributeWithoutPrefix
protected boolean printAttributeWithoutPrefix(org.w3c.dom.Attr attribute,
boolean hasAttribute)
checkEscaping
protected boolean checkEscaping(java.lang.String localName)
getTextNodeData
protected java.lang.String getTextNodeData(org.w3c.dom.Text node)
mixedContent
protected boolean mixedContent(org.w3c.dom.NodeList list)
printChildren
protected void printChildren(org.w3c.dom.Node parent,
java.util.Map namespaces)
getLocalName
protected java.lang.String getLocalName(org.w3c.dom.Node node)
printEnd
protected void printEnd(java.lang.String text,
boolean endWithComma)
println
protected void println(java.lang.String text)
print
protected void print(java.lang.String text)
printIndent
protected void printIndent()