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 TypeMethodDescriptionvoid
addAttribute
(String key, String value) void
endElement
(String name) protected void
Write the end of line character (using specified line separator) and start new line with indentationprotected int
getDepth()
Get the current depth in the xml indentationGet the docType in the xmlprotected String
Get the current encoding in the xmlprotected String
Get the string used as line indenterprotected String
Get the string used as line separator or LS if not set.protected Writer
Get the underlying writervoid
startElement
(String name) void
writeMarkup
(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;
-