public interface MarkupWriter
Modifier and Type | Method and Description |
---|---|
void |
addListener(MarkupWriterListener listener)
Adds a markup writer listener that will be notified as elements are started and ended.
|
Element |
attributeNS(java.lang.String namespace,
java.lang.String attributeName,
java.lang.String attributeValue)
Creates an attribute within the namespace for the current element.
|
void |
attributes(java.lang.Object... namesAndValues)
Adds a series of attributes and values.
|
void |
cdata(java.lang.String content)
Adds parsed character content.
|
void |
comment(java.lang.String text)
Adds an XML comment.
|
Element |
defineNamespace(java.lang.String namespace,
java.lang.String namespacePrefix)
Defines a namespace for the currently active element.
|
Element |
element(java.lang.String name,
java.lang.Object... attributes)
Begins a new element as a child of the current element.
|
Element |
elementNS(java.lang.String namespace,
java.lang.String elementName)
Starts an element within the given namespace.
|
Element |
end()
Ends the current element.
|
Document |
getDocument()
Returns the Document into which this writer creates elements or other nodes.
|
Element |
getElement()
Returns the currently active element.
|
void |
removeListener(MarkupWriterListener listener)
Removes a previously added listener.
|
void |
toMarkup(java.io.PrintWriter writer)
Converts the collected markup into an markup stream (according to rules provided by the
Document 's MarkupModel ). |
void |
write(java.lang.String text)
Writes the text as a child of the current element.
|
void |
writef(java.lang.String format,
java.lang.Object... args)
Writes a formatted string.
|
void |
writeRaw(java.lang.String text)
Writes raw text, text with existing markup that should be passed through the client without change.
|
Element element(java.lang.String name, java.lang.Object... attributes)
name
- the name of the element to createattributes
- an even number of values, alternating names and valuesattributes(Object[])
Element end()
void write(java.lang.String text)
void writef(java.lang.String format, java.lang.Object... args)
void writeRaw(java.lang.String text)
text
- Raw
void comment(java.lang.String text)
void cdata(java.lang.String content)
write(String)
.content
- pre-parsed contentvoid attributes(java.lang.Object... namesAndValues)
void toMarkup(java.io.PrintWriter writer)
Document
's MarkupModel
). The markup stream is sent to the writer.Document getDocument()
Element getElement()
Element defineNamespace(java.lang.String namespace, java.lang.String namespacePrefix)
namespace
- the namespace URInamespacePrefix
- the prefix for elements and attributes associated with the namespace (may be the empty
string for the default namespace)Element elementNS(java.lang.String namespace, java.lang.String elementName)
end()
.namespace
- URI containing the elementelementName
- name of the element within the namespaceElement attributeNS(java.lang.String namespace, java.lang.String attributeName, java.lang.String attributeValue)
namespace
- URI containing the elementattributeName
- name of the attribute within the namespaceattributeValue
- the value for the attributevoid addListener(MarkupWriterListener listener)
void removeListener(MarkupWriterListener listener)
${project.version} - Copyright © 2003-2015 The Apache Software Foundation.