Class PrettyPrintXMLWriter
- java.lang.Object
-
- org.apache.maven.shared.utils.xml.PrettyPrintXMLWriter
-
-
Constructor Summary
Constructors Constructor Description PrettyPrintXMLWriter(java.io.PrintWriter writer)
PrettyPrintXMLWriter(java.io.PrintWriter writer, java.lang.String lineIndent)
PrettyPrintXMLWriter(java.io.PrintWriter writer, java.lang.String encoding, java.lang.String doctype)
PrettyPrintXMLWriter(java.io.PrintWriter writer, java.lang.String lineIndent, java.lang.String encoding, java.lang.String doctype)
PrettyPrintXMLWriter(java.io.PrintWriter writer, java.lang.String lineIndent, java.lang.String lineSeparator, java.lang.String encoding, java.lang.String doctype)
PrettyPrintXMLWriter(java.io.Writer writer)
PrettyPrintXMLWriter(java.io.Writer writer, java.lang.String lineIndent)
PrettyPrintXMLWriter(java.io.Writer writer, java.lang.String encoding, java.lang.String doctype)
PrettyPrintXMLWriter(java.io.Writer writer, java.lang.String lineIndent, java.lang.String encoding, java.lang.String doctype)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addAttribute(java.lang.String key, java.lang.String value)
Add a XML attribute to the current XML Element.void
endElement()
End the previously opened element.void
setDocType(java.lang.String docType)
Sets the docType of the document.void
setEncoding(java.lang.String encoding)
Sets the encoding of the document.void
setLineIndenter(java.lang.String lineIndentParameter)
void
setLineSeparator(java.lang.String lineSeparator)
void
startElement(java.lang.String elementName)
Start an XML Element tag.void
writeMarkup(java.lang.String markup)
Add a preformatted markup to the current element tagvoid
writeText(java.lang.String text)
Add a value text to the current element tag This will perform XML escaping to guarantee valid content
-
-
-
Constructor Detail
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(java.io.PrintWriter writer, java.lang.String lineIndent)
- Parameters:
writer
- not nulllineIndent
- could be null, but the normal way is some spaces.
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(java.io.Writer writer, java.lang.String lineIndent)
- Parameters:
writer
- not nulllineIndent
- could be null, but the normal way is some spaces.
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(java.io.PrintWriter writer)
- Parameters:
writer
- not null
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(java.io.Writer writer)
- Parameters:
writer
- not null
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(java.io.PrintWriter writer, java.lang.String lineIndent, java.lang.String encoding, java.lang.String doctype)
- Parameters:
writer
- not nulllineIndent
- could be null, but the normal way is some spaces.encoding
- could be null or invalid.doctype
- could be null.
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(java.io.Writer writer, java.lang.String lineIndent, java.lang.String encoding, java.lang.String doctype)
- Parameters:
writer
- not nulllineIndent
- could be null, but the normal way is some spaces.encoding
- could be null or invalid.doctype
- could be null.
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(java.io.PrintWriter writer, java.lang.String encoding, java.lang.String doctype)
- Parameters:
writer
- not nullencoding
- could be null or invalid.doctype
- could be null.
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(java.io.Writer writer, java.lang.String encoding, java.lang.String doctype)
- Parameters:
writer
- not nullencoding
- could be null or invalid.doctype
- could be null.
-
PrettyPrintXMLWriter
public PrettyPrintXMLWriter(java.io.PrintWriter writer, java.lang.String lineIndent, java.lang.String lineSeparator, java.lang.String encoding, java.lang.String doctype)
- Parameters:
writer
- not nulllineIndent
- could be null, but the normal way is some spaces.lineSeparator
- could be null, but the normal way is valid line separatorencoding
- could be null or the encoding to use.doctype
- could be null.
-
-
Method Detail
-
addAttribute
public void addAttribute(java.lang.String key, java.lang.String value) throws java.io.IOException
Add a XML attribute to the current XML Element. This method must get called immediately afterXMLWriter.startElement(String)
- Specified by:
addAttribute
in interfaceXMLWriter
- Parameters:
key
- The key of the attribute.value
- The value of the attribute.- Throws:
java.io.IOException
- if adding the attribute fails.
-
setEncoding
public void setEncoding(java.lang.String encoding)
Sets the encoding of the document. If not set, UTF-8 is being used- Specified by:
setEncoding
in interfaceXMLWriter
- Parameters:
encoding
- the encoding
-
setDocType
public void setDocType(java.lang.String docType)
Sets the docType of the document.- Specified by:
setDocType
in interfaceXMLWriter
- Parameters:
docType
- the docType
-
setLineSeparator
public void setLineSeparator(java.lang.String lineSeparator)
- Parameters:
lineSeparator
- The line separator to be used.
-
setLineIndenter
public void setLineIndenter(java.lang.String lineIndentParameter)
- Parameters:
lineIndentParameter
- The line indent parameter.
-
startElement
public void startElement(java.lang.String elementName) throws java.io.IOException
Start an XML Element tag.- Specified by:
startElement
in interfaceXMLWriter
- Parameters:
elementName
- The name of the tag.- Throws:
java.io.IOException
- if starting the element fails.
-
writeText
public void writeText(java.lang.String text) throws java.io.IOException
Add a value text to the current element tag This will perform XML escaping to guarantee valid content
-
writeMarkup
public void writeMarkup(java.lang.String markup) throws java.io.IOException
Add a preformatted markup to the current element tag- Specified by:
writeMarkup
in interfaceXMLWriter
- Parameters:
markup
- The text which should be written.- Throws:
java.io.IOException
- if writing the markup fails.
-
endElement
public void endElement() throws java.io.IOException
End the previously opened element.- Specified by:
endElement
in interfaceXMLWriter
- Throws:
java.io.IOException
- if ending the element fails.- See Also:
XMLWriter.startElement(String)
-
-