Package org.apache.camel.xml.io
Class XMLWriter
java.lang.Object
org.apache.camel.xml.io.XMLWriter
XML writer which emits nicely formatted documents.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddAttribute(String key, String value) voidendElement(String name) protected voidWrite the end of line character (using specified line separator) and start new line with indentationprotected intgetDepth()Get the current depth in the xml indentationGet 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 WriterGet the underlying writervoidstartElement(String name) voidwriteMarkup(String text) void
-
Constructor Details
-
XMLWriter
- Parameters:
writer- not null- Throws:
IOException
-
XMLWriter
- Parameters:
writer- not nulllineIndenter- could be null, but the normal way is some spaces.- Throws:
IOException
-
XMLWriter
- Parameters:
writer- not nullencoding- could be null or invalid.doctype- could be null.- Throws:
IOException
-
XMLWriter
public XMLWriter(Writer writer, String lineIndenter, String encoding, String doctype) throws IOException - Parameters:
writer- not nulllineIndenter- could be null, but the normal way is some spaces.encoding- could be null or invalid.doctype- could be null.- Throws:
IOException
-
XMLWriter
public XMLWriter(Writer writer, String lineIndenter, String lineSeparator, String encoding, String doctype) throws IOException - 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.- Throws:
IOException
-
-
Method Details
-
startElement
- Throws:
IOException
-
writeText
- Throws:
IOException
-
writeMarkup
- Throws:
IOException
-
addAttribute
- Throws:
IOException
-
endElement
- Throws:
IOException
-
getLineIndenter
Get the string used as line indenter- Returns:
- the line indenter
-
getLineSeparator
Get the string used as line separator or LS if not set.- Returns:
- the line separator
- See Also:
-
endOfLine
Write the end of line character (using specified line separator) and start new line with indentation- Throws:
IOException- See Also:
-
getWriter
Get the underlying writer- Returns:
- the underlying writer
-
getDepth
protected int getDepth()Get the current depth in the xml indentation- Returns:
- the current depth
-
getEncoding
Get the current encoding in the xml- Returns:
- the current encoding
-
getDocType
Get the docType in the xml- Returns:
- the current docType
-
getElements
- Returns:
- the current elementStack;
-