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 void
addAttribute(String name, boolean value)
Adds a boolean attribute to current element.default void
addAttribute(String name, byte value)
Adds a byte attribute to current element.default void
addAttribute(String name, char value)
Adds a char attribute to current element.default void
addAttribute(String name, double value)
Adds a double attribute to current element.default void
addAttribute(String name, float value)
Adds a float attribute to current element.default void
addAttribute(String name, int value)
Adds an int attribute to current element.default void
addAttribute(String name, long value)
Adds a long attribute to current element.default void
addAttribute(String name, short value)
Adds a short attribute to current element.default void
addAttribute(String name, Object value)
Adds an Object attribute to current element.void
addAttribute(String name, String value)
Adds a String attribute to current element.default void
addCData(String content)
Inserts a CData section with a content.void
addCDataContent(String content)
Adds content to current CData.default void
addComment(String content)
Inserts a comment section with a content.void
addCommentContent(String content)
Adds content to current comment.default void
addDefaultNamespace(String uri)
default void
addElement(String name, String content)
void
addElementContent(String content)
default void
addElementIfNonEmpty(String name, String content)
default void
addNamespace(String prefix, String uri)
Adds a namespace declaration.void
addProcessingInstruction(String target, String content)
void
addProcessingInstructionContent(String content)
default void
addStyleSheet(String xsl)
Helper function used to insert a StyleSheet Processing Instruction.void
beginCData()
Starts the writing of a new CData.void
beginComment()
Starts the writing of a new comment.default void
beginDocument()
Begins an XML document, using writer's encoding and version 1.0.void
beginDocument(XmlVersion version)
Begins an XML document, using writer's encoding.void
beginElement(String name)
void
beginProcessingInstruction(String target)
void
endCData()
Closes the current CData.void
endComment()
Closes the current comment.void
endDocument()
void
endElement()
void
endProcessingInstruction()
-
-
-
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 IOException
Begins 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 IOException
Starts 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 IOException
Closes 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 IOException
Starts 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 IOException
Closes 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.
-
-