Class XmlTreeRenderer
java.lang.Object
net.sourceforge.pmd.util.treeexport.XmlTreeRenderer
- All Implemented Interfaces:
TreeRenderer
Renders a tree to XML. The resulting document is as close as possible
to the representation PMD uses to run XPath queries on nodes. This
allows the same XPath queries to match, in theory (it would depend
on the XPath engine used I believe).
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionCreates a new XML renderer with a default configuration.Creates a new XML renderer. -
Method Summary
Modifier and TypeMethodDescriptionvoidrenderSubtree(Node node, Appendable out) Appends the subtree rooted at the given node on the provided output writer.
-
Constructor Details
-
XmlTreeRenderer
Creates a new XML renderer.- Parameters:
strategy- Strategy to parameterize the output of this instance
-
XmlTreeRenderer
public XmlTreeRenderer()Creates a new XML renderer with a default configuration.
-
-
Method Details
-
renderSubtree
Appends the subtree rooted at the given node on the provided output writer. The implementation is free to filter out some nodes from the subtree.Each node of the AST has a corresponding XML element, whose name and attributes are the one the node presents in XPath queries.
- Specified by:
renderSubtreein interfaceTreeRenderer- Parameters:
node- Node to renderout- Object onto which the output is appended- Throws:
IllegalArgumentException- If some node has attributes or a name that is not a valid XML nameIOException- If an IO error occurs while appending to the output
-