Class PrettyPrintXMLWriter
java.lang.Object
org.apache.maven.shared.utils.xml.PrettyPrintXMLWriter
- All Implemented Interfaces:
XMLWriter
XMLWriter with nice indentation.
- Author:
- kama
-
Constructor Summary
ConstructorsConstructorDescriptionPrettyPrintXMLWriter(PrintWriter writer) PrettyPrintXMLWriter(PrintWriter writer, String lineIndent) PrettyPrintXMLWriter(PrintWriter writer, String encoding, String doctype) PrettyPrintXMLWriter(PrintWriter writer, String lineIndent, String encoding, String doctype) PrettyPrintXMLWriter(PrintWriter writer, String lineIndent, String lineSeparator, String encoding, String doctype) PrettyPrintXMLWriter(Writer writer) PrettyPrintXMLWriter(Writer writer, String lineIndent) PrettyPrintXMLWriter(Writer writer, String encoding, String doctype) PrettyPrintXMLWriter(Writer writer, String lineIndent, String encoding, String doctype) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, String value) Add a XML attribute to the current XML Element.voidEnd the previously opened element.voidsetDocType(String docType) Sets the DOCTYPE of the document.voidsetEncoding(String encoding) Sets the encoding of the document.voidsetLineIndenter(String lineIndentParameter) voidsetLineSeparator(String lineSeparator) voidstartElement(String elementName) Start an XML Element tag.voidwriteMarkup(String markup) Add preformatted markup to the current element tag.voidAdd text to the current element tag.
-
Constructor Details
-
PrettyPrintXMLWriter
- Parameters:
writer- not nulllineIndent- can be null, but the normal way is some spaces
-
PrettyPrintXMLWriter
- Parameters:
writer- not nulllineIndent- can be null, but the normal way is some spaces.
-
PrettyPrintXMLWriter
- Parameters:
writer- not null
-
PrettyPrintXMLWriter
- Parameters:
writer- not null
-
PrettyPrintXMLWriter
- Parameters:
writer- not nulllineIndent- can be null, but the normal way is some spacesencoding- can be null or invaliddoctype- can be null
-
PrettyPrintXMLWriter
- Parameters:
writer- not nulllineIndent- can be null, but the normal way is some spacesencoding- can be null or invaliddoctype- can be null
-
PrettyPrintXMLWriter
- Parameters:
writer- not nullencoding- can be null or invaliddoctype- can be null
-
PrettyPrintXMLWriter
- Parameters:
writer- not nullencoding- can be null or invaliddoctype- can be null
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(PrintWriter writer, String lineIndent, String lineSeparator, String encoding, String doctype) - Parameters:
writer- not nulllineIndent- can be null, but the normal way is some spaces.lineSeparator- can be null, but the normal way is valid line separatorencoding- can be null or the encoding to use.doctype- can be null
-
-
Method Details
-
addAttribute
Add a XML attribute to the current XML Element. This method must get called immediately afterXMLWriter.startElement(String).- Specified by:
addAttributein interfaceXMLWriter- Parameters:
key- The key of the attribute.value- The value of the attribute.- Throws:
IOException- if adding the attribute fails.
-
setEncoding
Sets the encoding of the document. If not set, UTF-8 is used.- Specified by:
setEncodingin interfaceXMLWriter- Parameters:
encoding- the encoding
-
setDocType
Sets the DOCTYPE of the document.- Specified by:
setDocTypein interfaceXMLWriter- Parameters:
docType- the docType
-
setLineSeparator
- Parameters:
lineSeparator- the line separator to be output
-
setLineIndenter
- Parameters:
lineIndentParameter- the line indent parameter
-
startElement
Start an XML Element tag.- Specified by:
startElementin interfaceXMLWriter- Parameters:
elementName- the name of the tag- Throws:
IOException- if starting the element fails
-
writeText
Add text to the current element tag. This performs XML escaping to guarantee well-formed content.- Specified by:
writeTextin interfaceXMLWriter- Parameters:
text- The text which should be written.- Throws:
IOException- if writing the text fails.
-
writeMarkup
Add preformatted markup to the current element tag.- Specified by:
writeMarkupin interfaceXMLWriter- Parameters:
markup- the text which should be written- Throws:
IOException- if writing the markup fails
-
endElement
End the previously opened element.- Specified by:
endElementin interfaceXMLWriter- Throws:
IOException- if ending the element fails.- See Also:
-