public class XMLWriter extends Object
| Constructor and Description |
|---|
XMLWriter(ICharacterStream.Writable.Buffered output,
boolean includeXMLDeclaration,
boolean pretty)
Constructor.
|
XMLWriter(IO.Writable.Buffered output,
Charset encoding,
boolean includeXMLDeclaration,
boolean pretty)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
IAsync<IOException> |
addAttribute(CharSequence name,
CharSequence value)
Add an attribute to the current element.
|
IAsync<IOException> |
addCData(CharSequence data)
Add a CDATA section inside the current element.
|
IAsync<IOException> |
addComment(CharSequence comment)
Add a comment inside the current element.
|
IAsync<IOException> |
addText(CharSequence text)
Add text inside the current element.
|
IAsync<IOException> |
closeElement()
Close the current element.
|
IAsync<IOException> |
end()
End the document, close any open element, and flush the output stream.
|
IAsync<IOException> |
endOfAttributes()
Signal the end of attributes, so the opening tag can be closed and the content can start.
|
protected IAsync<IOException> |
endOfAttributes(net.lecousin.framework.xml.XMLWriter.Context ctx) |
static String |
escape(CharSequence s)
Escape a string to include it in XML (this is automatically called by other methods of this class when needed).
|
protected void |
indent() |
IAsync<IOException> |
openElement(String namespaceURI,
String localName,
Map<String,String> namespaces)
Open a new element.
|
IAsync<IOException> |
start(String rootNamespaceURI,
String rootLocalName,
Map<String,String> namespaces)
Start the document with the XML processing instruction if needed, and opening the root element.
|
IAsync<IOException> |
write(Element element)
Write the given DOM element.
|
public XMLWriter(IO.Writable.Buffered output, Charset encoding, boolean includeXMLDeclaration, boolean pretty)
public XMLWriter(ICharacterStream.Writable.Buffered output, boolean includeXMLDeclaration, boolean pretty)
public static String escape(CharSequence s)
public IAsync<IOException> start(String rootNamespaceURI, String rootLocalName, Map<String,String> namespaces)
rootNamespaceURI - namespace of the root elementrootLocalName - name of the root elementnamespaces - mapping from namespace URI to prefix, prefix may be empty for default namespacepublic IAsync<IOException> end()
protected void indent()
public IAsync<IOException> addAttribute(CharSequence name, CharSequence value)
public IAsync<IOException> endOfAttributes()
protected IAsync<IOException> endOfAttributes(net.lecousin.framework.xml.XMLWriter.Context ctx)
public IAsync<IOException> openElement(String namespaceURI, String localName, Map<String,String> namespaces)
public IAsync<IOException> closeElement()
public IAsync<IOException> addText(CharSequence text)
public IAsync<IOException> addCData(CharSequence data)
public IAsync<IOException> addComment(CharSequence comment)
public IAsync<IOException> write(Element element)
Copyright © 2019. All rights reserved.