Class AbstractXmlWriter
java.lang.Object
com.aquima.interactions.foundation.xml.writer.AbstractXmlWriter
- All Implemented Interfaces:
IXmlWriter
- Direct Known Subclasses:
XmlStreamWriter
,XmlWriter
Writer to write Xml objects to a stream.
- Since:
- 7.4
- Author:
- Jon van Leuven
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract String
protected abstract void
void
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.
-
Constructor Details
-
Method Details
-
write
- Throws:
IOException
-
getXmlDeclaration
-
writeXmlDecleration
Description copied from interface:IXmlWriter
Writes the xml document declaration. For example: <?xml version="1.0" encoding="UTF-8" ?>- Specified by:
writeXmlDecleration
in interfaceIXmlWriter
- Throws:
IOException
- If an I/O error occurs.
-
writeAttribute
Description copied from interface:IXmlWriter
Writes an attribute value to the stream.- Specified by:
writeAttribute
in interfaceIXmlWriter
- 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
- Specified by:
writeAttribute
in interfaceIXmlWriter
- Throws:
IOException
-
writeAttribute
- Specified by:
writeAttribute
in interfaceIXmlWriter
- Throws:
IOException
-
writeTagStart
Description copied from interface:IXmlWriter
Write a start tag element to the stream.- Specified by:
writeTagStart
in interfaceIXmlWriter
- Parameters:
tagName
- The name of the tag, may not be null.- Throws:
IOException
- If an I/O error occurs.
-
writeTagEnd
Description copied from interface:IXmlWriter
Writes an end tag for the current element.- Specified by:
writeTagEnd
in interfaceIXmlWriter
- Throws:
IOException
- If an I/O error occurs.
-
writeCDataValue
Description copied from interface:IXmlWriter
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
- Specified by:
writeCDataValue
in interfaceIXmlWriter
- Parameters:
elementValue
- The value for the element, may not be null.- Throws:
IOException
- If an I/O error occurs.
-
writeCDataElement
Description copied from interface:IXmlWriter
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
- Specified by:
writeCDataElement
in interfaceIXmlWriter
- 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.
-
writeValue
Description copied from interface:IXmlWriter
This writes a value for the current element.
This method will escape xml sensitive characters before writing to the stream.
- Specified by:
writeValue
in interfaceIXmlWriter
- Parameters:
elementValue
- The value for the element, may not be null.- Throws:
IOException
- If an I/O error occurs.
-
writeComment
Description copied from interface:IXmlWriter
Writes a comment element to the stream.- Specified by:
writeComment
in interfaceIXmlWriter
- Parameters:
comment
- The comment, may be null.- Throws:
IOException
- If an I/O error occurs.
-