Package org.codehaus.plexus.util.xml
Class PrettyPrintXMLWriter
java.lang.Object
org.codehaus.plexus.util.xml.PrettyPrintXMLWriter
- All Implemented Interfaces:
- XMLWriter
- Direct Known Subclasses:
- CompactXMLWriter
Implementation of XMLWriter which emits nicely formatted documents.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionPrettyPrintXMLWriter(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 SummaryModifier 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 LinkedList<String>protected 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- 
LSLine separator ("\n" on UNIX)
 
- 
- 
Constructor Details- 
PrettyPrintXMLWriter- Parameters:
- writer- not null
- lineIndenter- could be null, but the normal way is some spaces.
 
- 
PrettyPrintXMLWriter- Parameters:
- writer- not null
- lineIndenter- could be null, but the normal way is some spaces.
 
- 
PrettyPrintXMLWriter- Parameters:
- writer- not null
 
- 
PrettyPrintXMLWriter- Parameters:
- writer- not null
 
- 
PrettyPrintXMLWriterpublic PrettyPrintXMLWriter(PrintWriter writer, String lineIndenter, String encoding, String doctype) - Parameters:
- writer- not null
- lineIndenter- could be null, but the normal way is some spaces.
- encoding- could be null or invalid.
- doctype- could be null.
 
- 
PrettyPrintXMLWriter- Parameters:
- writer- not null
- lineIndenter- could be null, but the normal way is some spaces.
- encoding- could be null or invalid.
- doctype- could be null.
 
- 
PrettyPrintXMLWriter- Parameters:
- writer- not null
- encoding- could be null or invalid.
- doctype- could be null.
 
- 
PrettyPrintXMLWriter- Parameters:
- writer- not null
- encoding- could be null or invalid.
- doctype- could be null.
 
- 
PrettyPrintXMLWriterpublic PrettyPrintXMLWriter(PrintWriter writer, String lineIndenter, String lineSeparator, String encoding, String doctype) - Parameters:
- writer- not null
- lineIndenter- 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 interface- XMLWriter
 
- 
writeText
- 
writeMarkup- Specified by:
- writeMarkupin interface- XMLWriter
 
- 
addAttribute- Specified by:
- addAttributein interface- XMLWriter
 
- 
endElementpublic void endElement()- Specified by:
- endElementin interface- XMLWriter
 
- 
getLineIndenterGet the string used as line indenter- Returns:
- the line indenter
 
- 
setLineIndenterSet the string used as line indenter- Parameters:
- lineIndenter- new line indenter, could be null, but the normal way is some spaces.
 
- 
getLineSeparatorGet the string used as line separator or LS if not set.- Returns:
- the line separator
- See Also:
 
- 
setLineSeparatorSet 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).
 
- 
endOfLineprotected void endOfLine()Write the end of line character (using specified line separator) and start new line with indentation- See Also:
 
- 
setWriterSet the underlying writer- Parameters:
- writer- not null writer
 
- 
getWriterGet the underlying writer- Returns:
- the underlying writer
 
- 
setDepthprotected void setDepth(int depth) Set the depth in the xml indentation- Parameters:
- depth- new depth
 
- 
getDepthprotected int getDepth()Get the current depth in the xml indentation- Returns:
- the current depth
 
- 
setEncodingSet the encoding in the xml- Parameters:
- encoding- new encoding
 
- 
getEncodingGet the current encoding in the xml- Returns:
- the current encoding
 
- 
setDocTypeSet the docType in the xml- Parameters:
- docType- new docType
 
- 
getDocTypeGet the docType in the xml- Returns:
- the current docType
 
- 
getElementStack- Returns:
- the current elementStack;
 
 
-