Package io.milton.http
Class XmlWriter
java.lang.Object
io.milton.http.XmlWriter
Lightweight XML generation. Gives the programmer fine grained control of the
generated xml, including whitespace.
The XML is not guaranteed to be parseable.
- Author:
- brad
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionclassRepresents an element which is currently being writtenstatic enum -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidWrite a closing tag for the given namevoidWrite a closing tag, Egvoidflush()Send data and reinitializes buffer.booleanvoidnewLine()voidWrite an opening tagvoidWrite an opening tagvoidsetAllowNewlines(boolean allowNewlines) static Charsetutf8()voidWrite a CDATA segment.voidwriteElement(String namespace, String name, XmlWriter.Type type) voidwriteElement(String nsPrefix, String nsUrl, String name, XmlWriter.Type type) voidwriteProperty(String name) voidwriteProperty(String namespace, String name) voidwriteProperty(String namespace, String name, String value) voidwriteProperty(String namespace, String namespaceInfo, String name, String value) Convenience method to write a single element containing a piece of textvoidAppend plain text.void
-
Field Details
-
out
-
charset
-
-
Constructor Details
-
XmlWriter
-
XmlWriter
-
-
Method Details
-
utf8
-
writeProperty
Convenience method to write a single element containing a piece of text- Parameters:
namespace- - optional, namespace prefixnamespaceInfo- - optional, namespace urlname- - the local name of the element to createvalue- - the raw text to insert into the element
-
writeProperty
-
writeProperty
-
writeProperty
-
writeElement
-
open
Write an opening tag- Parameters:
namespace-name-
-
close
Write a closing tag, Eg- Parameters:
namespace-name-
-
open
Write an opening tag- Parameters:
name-
-
close
Write a closing tag for the given name- Parameters:
name-
-
begin
-
begin
-
writeElement
-
writeText
Append plain text.- Parameters:
text- Text to append
-
writeData
Write a CDATA segment.- Parameters:
data- Data to append
-
writeXMLHeader
public void writeXMLHeader() -
flush
public void flush()Send data and reinitializes buffer. -
newLine
public void newLine() -
isAllowNewlines
public boolean isAllowNewlines() -
setAllowNewlines
public void setAllowNewlines(boolean allowNewlines)
-