Class XmlTreeRenderer.XmlRenderingConfig
- java.lang.Object
-
- net.sourceforge.pmd.util.treeexport.XmlTreeRenderer.XmlRenderingConfig
-
- Enclosing class:
- XmlTreeRenderer
public static class XmlTreeRenderer.XmlRenderingConfig extends Object
A strategy to parameterize anXmlTreeRenderer
.
-
-
Constructor Summary
Constructors Constructor Description XmlRenderingConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
handleAttributeFetchException(Attribute attr, Exception e)
Handle an exception that occurred while fetching the value of an attribute.XmlTreeRenderer.XmlRenderingConfig
indentWith(String indentString)
Sets the string that should be used to indent children elements.XmlTreeRenderer.XmlRenderingConfig
lineSeparator(String lineSeparator)
Sets the string that should be used to separate lines.XmlTreeRenderer.XmlRenderingConfig
renderProlog(boolean renderProlog)
Sets whether to render an XML prolog or not.XmlTreeRenderer.XmlRenderingConfig
singleQuoteAttributes(boolean useSingleQuote)
Sets the delimiters use for attribute values.protected boolean
takeAttribute(Node node, Attribute attribute)
Returns true if the attribute should be included in the element corresponding to the given node.
-
-
-
Method Detail
-
handleAttributeFetchException
protected void handleAttributeFetchException(Attribute attr, Exception e)
Handle an exception that occurred while fetching the value of an attribute. The default does nothing, it's meant to be overridden if you want to handle it.- Parameters:
attr
- Attribute for which the fetch failede
- Exception that occurred
-
takeAttribute
protected boolean takeAttribute(Node node, Attribute attribute)
Returns true if the attribute should be included in the element corresponding to the given node. Subclasses can override this method to filter out some attributes.- Parameters:
node
- Node owning the attributeattribute
- Attribute to test
-
lineSeparator
public XmlTreeRenderer.XmlRenderingConfig lineSeparator(String lineSeparator)
Sets the string that should be used to separate lines. The default is the platform-specific line separator. The following special values are interpreted specially:CR
,CRLF
,LF
,\r
,\r\n
and\n
. The latter three use literal backslashes and are interpreted like Java escapes. The former three are named aliases for the same.- Throws:
NullPointerException
- If the argument is null
-
singleQuoteAttributes
public XmlTreeRenderer.XmlRenderingConfig singleQuoteAttributes(boolean useSingleQuote)
Sets the delimiters use for attribute values. The default is to use single quotes.- Parameters:
useSingleQuote
- True for single quotes, false for double quotes
-
renderProlog
public XmlTreeRenderer.XmlRenderingConfig renderProlog(boolean renderProlog)
Sets whether to render an XML prolog or not. The default is true.
-
indentWith
public XmlTreeRenderer.XmlRenderingConfig indentWith(String indentString)
Sets the string that should be used to indent children elements. The default is four spaces.- Throws:
NullPointerException
- If the argument is null
-
-