Constructor and Description |
---|
PrettyPrintXMLWriter(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) |
Modifier and Type | Method and Description |
---|---|
void |
addAttribute(String key,
String value)
Add a XML attribute to the current XML Element.
|
void |
endElement()
End the previously opened element.
|
void |
setDocType(String docType)
Sets the DOCTYPE of the document.
|
void |
setEncoding(String encoding)
Sets the encoding of the document.
|
void |
setLineIndenter(String lineIndentParameter) |
void |
setLineSeparator(String lineSeparator) |
void |
startElement(String elementName)
Start an XML Element tag.
|
void |
writeMarkup(String markup)
Add preformatted markup to the current element tag.
|
void |
writeText(String text)
Add text to the current element tag.
|
public PrettyPrintXMLWriter(PrintWriter writer, String lineIndent)
writer
- not nulllineIndent
- can be null, but the normal way is some spacespublic PrettyPrintXMLWriter(Writer writer, String lineIndent)
writer
- not nulllineIndent
- can be null, but the normal way is some spaces.public PrettyPrintXMLWriter(PrintWriter writer)
writer
- not nullpublic PrettyPrintXMLWriter(Writer writer)
writer
- not nullpublic PrettyPrintXMLWriter(PrintWriter writer, String lineIndent, String encoding, String doctype)
writer
- not nulllineIndent
- can be null, but the normal way is some spacesencoding
- can be null or invaliddoctype
- can be nullpublic PrettyPrintXMLWriter(Writer writer, String lineIndent, String encoding, String doctype)
writer
- not nulllineIndent
- can be null, but the normal way is some spacesencoding
- can be null or invaliddoctype
- can be nullpublic PrettyPrintXMLWriter(PrintWriter writer, String encoding, String doctype)
writer
- not nullencoding
- can be null or invaliddoctype
- can be nullpublic PrettyPrintXMLWriter(Writer writer, String encoding, String doctype)
writer
- not nullencoding
- can be null or invaliddoctype
- can be nullpublic PrettyPrintXMLWriter(PrintWriter writer, String lineIndent, String lineSeparator, String encoding, String doctype)
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 nullpublic void addAttribute(String key, String value) throws IOException
XMLWriter.startElement(String)
.addAttribute
in interface XMLWriter
key
- The key of the attribute.value
- The value of the attribute.IOException
- if adding the attribute fails.public void setEncoding(String encoding)
setEncoding
in interface XMLWriter
encoding
- the encodingpublic void setDocType(String docType)
setDocType
in interface XMLWriter
docType
- the docTypepublic void setLineSeparator(String lineSeparator)
lineSeparator
- the line separator to be outputpublic void setLineIndenter(String lineIndentParameter)
lineIndentParameter
- the line indent parameterpublic void startElement(String elementName) throws IOException
startElement
in interface XMLWriter
elementName
- the name of the tagIOException
- if starting the element failspublic void writeText(String text) throws IOException
writeText
in interface XMLWriter
text
- The text which should be written.IOException
- if writing the text fails.public void writeMarkup(String markup) throws IOException
writeMarkup
in interface XMLWriter
markup
- the text which should be writtenIOException
- if writing the markup failspublic void endElement() throws IOException
endElement
in interface XMLWriter
IOException
- if ending the element fails.XMLWriter.startElement(String)
Copyright © 2002–2021 The Apache Software Foundation. All rights reserved.