Package cdc.util.xml
Interface XmlHandler
-
- All Known Implementing Classes:
XmlWriter
public interface XmlHandler
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default voidaddAttribute(String name, boolean value)Adds a boolean attribute to current element.default voidaddAttribute(String name, byte value)Adds a byte attribute to current element.default voidaddAttribute(String name, char value)Adds a char attribute to current element.default voidaddAttribute(String name, double value)Adds a double attribute to current element.default voidaddAttribute(String name, float value)Adds a float attribute to current element.default voidaddAttribute(String name, int value)Adds an int attribute to current element.default voidaddAttribute(String name, long value)Adds a long attribute to current element.default voidaddAttribute(String name, short value)Adds a short attribute to current element.default voidaddAttribute(String name, Object value)Adds an Object attribute to current element.voidaddAttribute(String name, String value)Adds a String attribute to current element.default voidaddCData(String content)Inserts a CData section with a content.voidaddCDataContent(String content)Adds content to current CData.default voidaddComment(String content)Inserts a comment section with a content.voidaddCommentContent(String content)Adds content to current comment.default voidaddDefaultNamespace(String uri)default voidaddElement(String name, String content)voidaddElementContent(String content)default voidaddElementIfNonEmpty(String name, String content)default voidaddNamespace(String prefix, String uri)Adds a namespace declaration.voidaddProcessingInstruction(String target, String content)voidaddProcessingInstructionContent(String content)default voidaddStyleSheet(String xsl)Helper function used to insert a StyleSheet Processing Instruction.voidbeginCData()Starts the writing of a new CData.voidbeginComment()Starts the writing of a new comment.default voidbeginDocument()Begins an XML document, using writer's encoding and version 1.0.voidbeginDocument(XmlVersion version)Begins an XML document, using writer's encoding.voidbeginElement(String name)voidbeginProcessingInstruction(String target)voidendCData()Closes the current CData.voidendComment()Closes the current comment.voidendDocument()voidendElement()voidendProcessingInstruction()
-
-
-
Method Detail
-
beginDocument
void beginDocument(XmlVersion version) throws IOException
Begins an XML document, using writer's encoding.- Parameters:
version- The XML version to use.- Throws:
IOException- If an I/O error occurs.
-
beginDocument
default void beginDocument() throws IOExceptionBegins an XML document, using writer's encoding and version 1.0.- Throws:
IOException- If an I/O error occurs.
-
endDocument
void endDocument() throws IOException- Throws:
IOException
-
addDefaultNamespace
default void addDefaultNamespace(String uri) throws IOException
- Throws:
IOException
-
addNamespace
default void addNamespace(String prefix, String uri) throws IOException
Adds a namespace declaration.- Parameters:
prefix- Namespace prefixuri- Associated URI.- Throws:
IOException- If an I/O error occurs.
-
beginProcessingInstruction
void beginProcessingInstruction(String target) throws IOException
- Throws:
IOException
-
addProcessingInstructionContent
void addProcessingInstructionContent(String content) throws IOException
- Throws:
IOException
-
endProcessingInstruction
void endProcessingInstruction() throws IOException- Throws:
IOException
-
addProcessingInstruction
void addProcessingInstruction(String target, String content) throws IOException
- Throws:
IOException
-
addStyleSheet
default void addStyleSheet(String xsl) throws IOException
Helper function used to insert a StyleSheet Processing Instruction.- Parameters:
xsl- The URL of the style sheet to use.- Throws:
IOException- If an I/O error occurs.
-
beginComment
void beginComment() throws IOExceptionStarts the writing of a new comment.- Throws:
IOException- If an I/O error occurs.
-
addCommentContent
void addCommentContent(String content) throws IOException
Adds content to current comment.- Parameters:
content- The text to add to current comment.- Throws:
IOException
-
endComment
void endComment() throws IOExceptionCloses the current comment.- Throws:
IOException- If an I/O error occurs.
-
addComment
default void addComment(String content) throws IOException
Inserts a comment section with a content.- Parameters:
content- The comment content.- Throws:
IOException- If an I/O error occurs.
-
beginCData
void beginCData() throws IOExceptionStarts the writing of a new CData.- Throws:
IOException- If an I/O error occurs.
-
addCDataContent
void addCDataContent(String content) throws IOException
Adds content to current CData.- Parameters:
content- The text to add to current CData.- Throws:
IOException
-
endCData
void endCData() throws IOExceptionCloses the current CData.- Throws:
IOException- If an I/O error occurs.
-
addCData
default void addCData(String content) throws IOException
Inserts a CData section with a content.- Parameters:
content- The CData content.- Throws:
IOException- If an I/O error occurs.
-
beginElement
void beginElement(String name) throws IOException
- Throws:
IOException
-
addElementContent
void addElementContent(String content) throws IOException
- Throws:
IOException
-
endElement
void endElement() throws IOException- Throws:
IOException
-
addElement
default void addElement(String name, String content) throws IOException
- Throws:
IOException
-
addElementIfNonEmpty
default void addElementIfNonEmpty(String name, String content) throws IOException
- Throws:
IOException
-
addAttribute
void addAttribute(String name, String value) throws IOException
Adds a String attribute to current element.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
addAttribute
default void addAttribute(String name, Object value) throws IOException
Adds an Object attribute to current element.If object is null adds an empty attribute.
Otherwise, uses toString() to convert value to a String.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
addAttribute
default void addAttribute(String name, char value) throws IOException
Adds a char attribute to current element.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
addAttribute
default void addAttribute(String name, boolean value) throws IOException
Adds a boolean attribute to current element.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
addAttribute
default void addAttribute(String name, long value) throws IOException
Adds a long attribute to current element.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
addAttribute
default void addAttribute(String name, int value) throws IOException
Adds an int attribute to current element.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
addAttribute
default void addAttribute(String name, short value) throws IOException
Adds a short attribute to current element.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
addAttribute
default void addAttribute(String name, byte value) throws IOException
Adds a byte attribute to current element.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
addAttribute
default void addAttribute(String name, double value) throws IOException
Adds a double attribute to current element.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
addAttribute
default void addAttribute(String name, float value) throws IOException
Adds a float attribute to current element.- Parameters:
name- Attribute name.value- Attribute value.- Throws:
IOException- If an I/O error occurs.
-
-