Class PrettyPrintXMLWriter
java.lang.Object
org.codehaus.plexus.util.xml.PrettyPrintXMLWriter
- All Implemented Interfaces:
XMLWriter
- Direct Known Subclasses:
CompactXMLWriter
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionPrettyPrintXMLWriter(PrintWriter writer) PrettyPrintXMLWriter(PrintWriter writer, String lineIndenter) PrettyPrintXMLWriter(PrintWriter writer, String encoding, String doctype) PrettyPrintXMLWriter(PrintWriter writer, String lineIndenter, String encoding, String doctype) PrettyPrintXMLWriter(PrintWriter writer, String lineIndenter, String lineSeparator, String encoding, String doctype) PrettyPrintXMLWriter(Writer writer) PrettyPrintXMLWriter(Writer writer, String lineIndenter) PrettyPrintXMLWriter(Writer writer, String encoding, String doctype) PrettyPrintXMLWriter(Writer writer, String lineIndenter, String encoding, String doctype) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, String value) voidprotected voidWrite the end of line character (using specified line separator) and start new line with indentationprotected intgetDepth()Get the current depth in the xml indentationprotected StringGet the docType in the xmlprotected StringGet the current encoding in the xmlprotected StringGet the string used as line indenterprotected StringGet the string used as line separator or LS if not set.protected PrintWriterGet the underlying writerprotected voidsetDepth(int depth) Set the depth in the xml indentationprotected voidsetDocType(String docType) Set the docType in the xmlprotected voidsetEncoding(String encoding) Set the encoding in the xmlprotected voidsetLineIndenter(String lineIndenter) Set the string used as line indenterprotected voidsetLineSeparator(String lineSeparator) Set the string used as line separatorprotected voidsetWriter(PrintWriter writer) Set the underlying writervoidstartElement(String name) voidwriteMarkup(String text) void
-
Field Details
-
LS
Line separator ("\n" on UNIX)
-
-
Constructor Details
-
PrettyPrintXMLWriter
- Parameters:
writer- not nulllineIndenter- could be null, but the normal way is some spaces.
-
PrettyPrintXMLWriter
-
PrettyPrintXMLWriter
- Parameters:
writer- not null
-
PrettyPrintXMLWriter
- Parameters:
writer- not null
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(PrintWriter writer, String lineIndenter, String encoding, String doctype) - Parameters:
writer- not nulllineIndenter- could be null, but the normal way is some spaces.encoding- could be null or invalid.doctype- could be null.
-
PrettyPrintXMLWriter
-
PrettyPrintXMLWriter
- Parameters:
writer- not nullencoding- could be null or invalid.doctype- could be null.
-
PrettyPrintXMLWriter
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(PrintWriter writer, String lineIndenter, String lineSeparator, String encoding, String doctype) - Parameters:
writer- not nulllineIndenter- could be null, but the normal way is some spaces.lineSeparator- could be null, but the normal way is valid line separator ("\n" on UNIX).encoding- could be null or invalid.doctype- could be null.
-
-
Method Details
-
startElement
- Specified by:
startElementin interfaceXMLWriter
-
writeText
-
writeMarkup
- Specified by:
writeMarkupin interfaceXMLWriter
-
addAttribute
- Specified by:
addAttributein interfaceXMLWriter
-
endElement
public void endElement()- Specified by:
endElementin interfaceXMLWriter
-
getLineIndenter
-
setLineIndenter
Set the string used as line indenter- Parameters:
lineIndenter- new line indenter, could be null, but the normal way is some spaces.
-
getLineSeparator
Get the string used as line separator or LS if not set.- Returns:
- the line separator
- See Also:
-
setLineSeparator
Set the string used as line separator- Parameters:
lineSeparator- new line separator, could be null but the normal way is valid line separator ("\n" on UNIX).
-
endOfLine
protected void endOfLine()Write the end of line character (using specified line separator) and start new line with indentation- See Also:
-
setWriter
Set the underlying writer- Parameters:
writer- not null writer
-
getWriter
-
setDepth
protected void setDepth(int depth) Set the depth in the xml indentation- Parameters:
depth- new depth
-
getDepth
protected int getDepth()Get the current depth in the xml indentation- Returns:
- the current depth
-
setEncoding
Set the encoding in the xml- Parameters:
encoding- new encoding
-
getEncoding
-
setDocType
Set the docType in the xml- Parameters:
docType- new docType
-
getDocType
-
getElementStack
-