public class XMLGeneratorVisitor extends AbstractDepthFirstVisitor
AbstractDepthFirstVisitor which can generate XML out of a NodeElement.
Accepts a PrintWriter in the constructor and uses it to output the generated XML.
Output can be controlled by enabling/disabling the various options present in XMLGeneratorVisitor.OutputBehavior by calling
enableOutputBehavior(OutputBehavior) or disableOutputBehavior(OutputBehavior)| Modifier and Type | Class and Description |
|---|---|
static class |
XMLGeneratorVisitor.OutputBehavior
Enum controlling the generated XML output
|
| Constructor and Description |
|---|
XMLGeneratorVisitor(PrintWriter out)
Constructor accepting the
PrintWriter. |
| Modifier and Type | Method and Description |
|---|---|
void |
disableAllOutputBehaviors()
Disables all output behaviors
|
void |
disableOutputBehavior(XMLGeneratorVisitor.OutputBehavior behavior)
Disables one particular
XMLGeneratorVisitor.OutputBehavior |
void |
enableAllOutputBehaviors()
Enables all output behaviors
|
void |
enableOutputBehavior(XMLGeneratorVisitor.OutputBehavior behavior)
Enables one particular
XMLGeneratorVisitor.OutputBehavior |
protected void |
endAttributes(NodeElement element)
Finish visiting attributes of the element.
|
protected void |
endChildren(NodeElement element)
Finish visiting children of the element.
|
protected void |
endElement(NodeElement element)
Finish visiting the element.
|
boolean |
isOutputBehaviorEnabled(XMLGeneratorVisitor.OutputBehavior behavior)
Returns true if the output behavior is enabled
|
protected void |
startAttributes(NodeElement element)
Starts visiting the attributes of the element.
|
protected void |
startChildren(NodeElement element)
Starts visiting children of the element.
|
protected void |
startElement(NodeElement element)
Starts visiting an element.
|
protected void |
visitAttribute(NodeElement element,
NodeAttribute attribute)
Visits an attribute.
|
protected void |
visitAttributes(NodeElement element,
List<NodeAttribute> attributes)
Visits the attributes of the element.
|
protected void |
visitElement(NodeElement element)
Visits the element.
|
visitpublic XMLGeneratorVisitor(PrintWriter out)
PrintWriter. All output behaviors are enabled by default.out - the PrintWriterpublic void enableAllOutputBehaviors()
public void disableAllOutputBehaviors()
public void enableOutputBehavior(XMLGeneratorVisitor.OutputBehavior behavior)
XMLGeneratorVisitor.OutputBehaviorbehavior - public void disableOutputBehavior(XMLGeneratorVisitor.OutputBehavior behavior)
XMLGeneratorVisitor.OutputBehaviorbehavior - public boolean isOutputBehaviorEnabled(XMLGeneratorVisitor.OutputBehavior behavior)
behavior - the output behavior to inspectprotected void startElement(NodeElement element)
startElement in class AbstractDepthFirstVisitorelement - the elementprotected void startAttributes(NodeElement element)
startAttributes in class AbstractDepthFirstVisitorelement - the elementprotected void visitAttributes(NodeElement element, List<NodeAttribute> attributes)
visitAttributes in class AbstractDepthFirstVisitorelement - the elementattributes - the attributesprotected void visitAttribute(NodeElement element, NodeAttribute attribute)
element - attribute - protected void endAttributes(NodeElement element)
endAttributes in class AbstractDepthFirstVisitorelement - the elementprotected void visitElement(NodeElement element)
visitElement in class AbstractDepthFirstVisitorelement - the elementprotected void startChildren(NodeElement element)
startChildren in class AbstractDepthFirstVisitorelement - the elementprotected void endChildren(NodeElement element)
endChildren in class AbstractDepthFirstVisitorelement - the elementprotected void endElement(NodeElement element)
endElement in class AbstractDepthFirstVisitorelement - the elementCopyright © 2003-2014 Terracotta, Inc.. All Rights Reserved.