public class XmlWriter extends Object
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 |
FORWARD_SLASH
A forward slash character
|
static char |
CHAR_NEW_LINE
A new line character
|
static char |
CHAR_SPACE
A special XML character
|
protected boolean |
offsetEnabled
An element offset is enabled
|
protected String |
offsetSpace
An offset space
|
protected Writer |
out
Writer
|
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
|
Constructor and Description |
---|
XmlWriter()
Default constructor a zero offset
|
XmlWriter(Writer out)
Writer constructor with a zero offset
|
XmlWriter(Writer out,
String offsetSpace)
A writer constructor
|
Modifier and Type | Method and Description |
---|---|
protected void |
newLine(int level)
Write a new line with an offset
|
String |
toString() |
protected XmlWriter |
write(int level,
CharSequence name,
Map<String,Object> attributes,
List<Object> children,
XmlElement element)
Render the XML code without header
|
XmlWriter |
write(int level,
XmlElement element)
Render the XML code without header
|
protected void |
writeValue(Object value,
XmlElement element,
String attribute,
Writer out)
Write escaped value to the output
|
public static final char XML_GT
public static final char XML_LT
public static final char XML_AMP
public static final char XML_QUOT
public static final char XML_2QUOT
public static final char CHAR_SPACE
public static final char CHAR_NEW_LINE
public static final char FORWARD_SLASH
public static final String CDATA_BEG
public static final String CDATA_END
public static final String COMMENT_BEG
public static final String COMMENT_END
protected final boolean offsetEnabled
@Nonnull public XmlWriter write(int level, @Nonnull XmlElement element) throws IOException
IOException
@Nonnull protected XmlWriter write(int level, @Nonnull CharSequence name, @Nullable Map<String,Object> attributes, @Nullable List<Object> children, @Nonnull XmlElement element) throws IOException
level
- Element nesting level.name
- Name of elementattributes
- Attributes of the elementchildren
- Childern of the elementelement
- Original elementIOException
protected void newLine(int level) throws IOException
IOException
protected void writeValue(@Nonnull Object value, @Nonnull XmlElement element, @Nullable String attribute, @Nonnull Writer out) throws IOException
value
- A value to writeelement
- The elementattribute
- A name of the XML attribute of null
value for a XML text.out
- An output writerIOException
Copyright 2019-2022, Pavel Ponec