Interface IXmlWriter
- All Known Implementing Classes:
AbstractXmlWriter
,XmlStreamWriter
,XmlWriter
,XmlWriterDelegate
public interface IXmlWriter
Interface describing a writer to write Xml objects to a stream.
- Since:
- 7.4
- Author:
- Jon van Leuven
-
Method Summary
Modifier and TypeMethodDescriptionvoid
writeAttribute
(String name, boolean attrValue) void
writeAttribute
(String name, int attrValue) void
writeAttribute
(String name, String attrValue) Writes an attribute value to the stream.void
writeCDataElement
(String elementName, String elementValue) This writes a new element with a single value as a child of the current element.void
writeCDataValue
(String elementValue) This writes a value for the current element.void
writeComment
(String comment) Writes a comment element to the stream.void
Writes an end tag for the current element.void
writeTagStart
(String tagName) Write a start tag element to the stream.void
writeValue
(String elementValue) This writes a value for the current element.void
Writes the xml document declaration.
-
Method Details
-
writeXmlDecleration
Writes the xml document declaration. For example: <?xml version="1.0" encoding="UTF-8" ?>- Throws:
IOException
- If an I/O error occurs.
-
writeTagStart
Write a start tag element to the stream.- Parameters:
tagName
- The name of the tag, may not be null.- Throws:
IOException
- If an I/O error occurs.
-
writeTagEnd
Writes an end tag for the current element.- Throws:
IOException
- If an I/O error occurs.
-
writeAttribute
Writes an attribute value to the stream.- Parameters:
name
- The name of the attribute, may not be null.attrValue
- The value of the attribute, when null no attribute will be written to the stream.- Throws:
IOException
- If an I/O error occurs.
-
writeAttribute
- Throws:
IOException
-
writeAttribute
- Throws:
IOException
-
writeValue
This writes a value for the current element.
This method will escape xml sensitive characters before writing to the stream.
- Parameters:
elementValue
- The value for the element, may not be null.- Throws:
IOException
- If an I/O error occurs.
-
writeCDataValue
This writes a value for the current element.
This method will NOT escape xml sensitive characters before writing to the stream, but will use <![CDATA[ ]]> generate valid xml
- Parameters:
elementValue
- The value for the element, may not be null.- Throws:
IOException
- If an I/O error occurs.
-
writeCDataElement
This writes a new element with a single value as a child of the current element.
This method will NOT escape xml sensitive characters before writing to the stream, but will use <![CDATA[ ]]> generate valid xml
- Parameters:
elementName
- The value for the element, may not be null.elementValue
- The value for the element, may not be null.- Throws:
IOException
- If an I/O error occurs.
-
writeComment
Writes a comment element to the stream.- Parameters:
comment
- The comment, may be null.- Throws:
IOException
- If an I/O error occurs.
-