@ParametersAreNonnullByDefault public class XMLGenerator extends XMLStructuredOutput
AbstractStructuredOutput.Element, AbstractStructuredOutput.ElementType, AbstractStructuredOutput.TagBuilder
out
nesting
Constructor and Description |
---|
XMLGenerator()
Creates a new XMLGenerator which uses an internal buffer to store the XML.
|
Modifier and Type | Method and Description |
---|---|
static Document |
createDocument(String namespaceURI,
String qualifiedName,
DocumentType docType)
Creates a new xml document.
|
String |
generate()
Returns the generated XML as string, using UTF-8 as encoding.
|
String |
generate(String encoding)
Returns the generated XML as string using the given encoding.
|
static void |
writeXML(Node doc,
Writer writer,
String encoding)
Writes the given XML document to the given writer.
|
static void |
writeXML(Node doc,
Writer writer,
String encoding,
boolean omitXMLDeclaration)
Writes the given XML document to the given writer.
|
beginOutput, beginOutput, beginResult, beginResult, buildBegin, close, endArray, endObject, endOutput, endResult, propertyIfFilled, startArray, startObject, text, writeProperty
array, array, beginArray, beginObject, beginObject, buildObject, endArray, endObject, getCurrentType, isCurrentObjectEmpty, nullsafeProperty, property
public XMLGenerator()
public String generate(String encoding)
encoding
- the encoding to use when converting the binary buffer to a String.public String generate()
public static void writeXML(Node doc, Writer writer, String encoding) throws TransformerException
doc
- the XML document to writewriter
- the target to write the XML toencoding
- the encoding used to write the XMLTransformerException
- if an exception during serialization occurs.public static void writeXML(Node doc, Writer writer, String encoding, boolean omitXMLDeclaration) throws TransformerException
doc
- the XML document to writewriter
- the target to write the XML toencoding
- the encoding used to write the XMLomitXMLDeclaration
- determines whether the XML declaration should be skipped (true) or not
(false).TransformerException
- if an exception during serialization occurs.public static Document createDocument(@Nullable String namespaceURI, String qualifiedName, @Nullable DocumentType docType) throws ParserConfigurationException
namespaceURI
- defines the uri of the default namespace used by the resulting documentqualifiedName
- returns the name of the root element of the resulting documentdocType
- specifies the DocumentType used by the resulting documentParserConfigurationException
- if no suitable xml implementation was found.Copyright © 2018. All rights reserved.