public interface Element
XmlElement
Modifier and Type | Field and Description |
---|---|
static String |
CDATA_BEG
A CDATA beg markup sequence
|
static String |
CDATA_END
A CDATA end markup sequence
|
static String |
COMMENT_BEG
A comment beg sequence
|
static String |
COMMENT_END
A comment end sequence
|
static char |
CHAR_NEW_LINE
A new line character
|
static char |
CHAR_SPACE
A special XML character
|
static char |
XML_2QUOT
A special XML character
|
static char |
XML_AMP
A special XML character
|
static char |
XML_GT
A special XML character
|
static char |
XML_LT
A special XML character
|
static char |
XML_QUOT
A special XML character
|
Modifier and Type | Method and Description |
---|---|
<T extends Element> |
addAttrib(CharSequence name,
Object value)
Add an attribute
|
<T extends Element> |
addCDATA(CharSequence charData)
Add a character data in
CDATA format to XML only. |
<T extends Element> |
addComment(CharSequence comment)
Add a comment text.
|
<T extends Element> |
addElement(CharSequence name)
Create a new
XmlElement for a required name and add it to children. |
<T extends Element> |
addElement(T element)
Add a child element
|
<T extends Element> |
addRawText(CharSequence rawText)
Add an native text with no escaped characters, for example: XML code, JavaScript, CSS styles
|
<T extends Element> |
addText(CharSequence text)
Add a text and escape special character
|
<T extends Element> |
addTextWithSpace(CharSequence text)
Add a text including a space (before and after the text)
|
Writer |
toWriter(Writer out)
Render the XML code without header
|
static final char XML_GT
static final char XML_LT
static final char XML_AMP
static final char XML_QUOT
static final char XML_2QUOT
static final char CHAR_SPACE
static final char CHAR_NEW_LINE
static final String CDATA_BEG
static final String CDATA_END
static final String COMMENT_BEG
static final String COMMENT_END
@Nonnull <T extends Element> T addElement(@Nonnull T element)
element
- Add a child element is required. An undefined argument is ignored.@Nonnull <T extends Element> T addElement(@Nonnull CharSequence name)
XmlElement
for a required name and add it to children.name
- A name of the new XmlElement is requred.@Nonnull <T extends Element> T addAttrib(@Nonnull CharSequence name, @Nullable Object value)
name
- Required element namevalue
- The null
value is ignored.@Nonnull <T extends Element> T addText(@Nullable CharSequence text)
text
- text An empty argument is ignored.@Nonnull <T extends Element> T addTextWithSpace(@Nullable CharSequence text)
text
- text An empty argument is ignored.@Nonnull <T extends Element> T addRawText(@Nullable CharSequence rawText)
rawText
- text An empty argument is ignored.@Nonnull <T extends Element> T addComment(@Nullable CharSequence comment)
comment
- A comment text must not contain a string -->
.@Nonnull <T extends Element> T addCDATA(@Nullable CharSequence charData)
CDATA
format to XML only.
The CDATA structure isn't really for HTML at all.charData
- A text including the DATA sequence. An empty argument is ignored.@Nonnull Writer toWriter(@Nonnull Writer out) throws IOException
IOException
Copyright 2019-2022, Pavel Ponec