org.codehaus.groovy.tools.xml
Class DomToGroovy

java.lang.Object
  extended by org.codehaus.groovy.tools.xml.DomToGroovy

public class DomToGroovy
extends java.lang.Object

A SAX handler for turning XML into Groovy scripts

Author:
James Strachan, paulk

Field Summary
private  boolean inMixed
           
private  java.util.List keywords
           
private  IndentPrinter out
           
private  java.lang.String qt
           
 
Constructor Summary
DomToGroovy(IndentPrinter out)
           
DomToGroovy(java.io.PrintWriter out)
           
 
Method Summary
private  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)
           
private  java.lang.String escapeQuote(java.lang.String text)
           
private  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)
           
private static org.w3c.dom.Document parse(java.lang.String name)
           
 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)
           
private  boolean printAttributeWithoutPrefix(org.w3c.dom.Attr attribute, boolean hasAttribute)
           
private  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)
           
private  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
 

Field Detail

out

private IndentPrinter out

inMixed

private boolean inMixed

qt

private java.lang.String qt

keywords

private java.util.List keywords
Constructor Detail

DomToGroovy

public DomToGroovy(java.io.PrintWriter out)

DomToGroovy

public DomToGroovy(IndentPrinter out)
Method Detail

print

public void print(org.w3c.dom.Document document)

main

public static void main(java.lang.String[] args)

parse

private static org.w3c.dom.Document parse(java.lang.String name)
                                   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

private 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

private 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

private void printAttributeWithPrefix(org.w3c.dom.Attr attribute,
                                      java.lang.StringBuffer buffer)

getAttributeValue

private java.lang.String getAttributeValue(org.w3c.dom.Attr attribute)

printAttributeWithoutPrefix

private boolean printAttributeWithoutPrefix(org.w3c.dom.Attr attribute,
                                            boolean hasAttribute)

checkEscaping

private 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()


Copyright © ${year} The Codehaus. All Rights Reserved.