S - object to writepublic abstract class XmlStreamWriter<S>
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
protected static java.lang.String |
XML_FRAGMENT |
| Constructor and Description |
|---|
XmlStreamWriter(EncodingContext context,
java.io.OutputStream outputStream,
S element) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addXlinkHrefAttr(java.lang.String value) |
protected void |
addXlinkTitleAttr(java.lang.String value) |
protected void |
attr(javax.xml.namespace.QName name,
java.lang.String value)
Write attribute to stream.
|
protected void |
attr(java.lang.String name,
java.lang.String value)
Write attribute to stream.
|
protected void |
attr(java.lang.String namespace,
java.lang.String localName,
java.lang.String value)
Write attribute to stream.
|
protected void |
chars(java.lang.String chars)
Write characters to stream.
|
protected void |
chars(java.lang.String chars,
boolean escape)
Write characters to stream.
|
protected void |
empty(javax.xml.namespace.QName name)
Write an empty element to stream.
|
protected void |
end()
Write the document end to stream.
|
protected void |
end(javax.xml.namespace.QName name)
Write the end element to new line.
|
protected void |
endInline(javax.xml.namespace.QName name)
Write end element to the same line.
|
protected void |
finish()
Finish the stream writing, flush and close.
|
protected void |
flush()
Flush written elements.
|
protected EncodingContext |
getContext()
Get the encoding context.
|
protected S |
getElement() |
protected java.util.Optional<java.lang.String> |
getEncodeNamespace() |
protected <T,S> java.util.Optional<Encoder<T,S>> |
getEncoder() |
protected <T,S> Encoder<T,S> |
getEncoder(EncoderKey key)
Get encoder for
EncoderKey. |
protected <T,S> Encoder<T,S> |
getEncoder(java.lang.String namespace,
java.lang.Object o) |
protected java.io.OutputStream |
getOutputStream()
Get the underlying output stream.
|
protected java.lang.String |
getReplacement(javax.xml.namespace.QName qname)
Create the replacement from
QName. |
protected org.apache.xmlbeans.XmlOptions |
getXmlOptions()
Get the XML options.
|
protected boolean |
isAddSchemaLocation() |
protected void |
namespace(java.lang.String prefix,
java.lang.String namespace)
Write namespace to stream.
|
protected void |
rawText(java.lang.String text)
Write raw text to stream an adds current indent before writing the text (and before each subsequent line).
|
protected void |
schemaLocation(java.util.Set<SchemaLocation> schemaLocations)
Write
SchemaLocations as xsi:schemaLocations attribute to stream. |
protected void |
start()
Write document start to stream with or without.
|
protected void |
start(javax.xml.namespace.QName name)
Write start element to stream.
|
protected void |
time(TimeInstant time)
Write
TimeInstant to stream. |
protected void |
time(TimePosition time)
Write
TimePosition as ISO 8601 to stream. |
protected <T,S> java.util.Optional<Encoder<T,S>> |
tryGetEncoder(EncoderKey key)
Try to get encoder for
EncoderKey. |
abstract void |
write()
Encode and write element to the
OutputStream. |
protected void |
writeXmlObject(org.apache.xmlbeans.XmlObject xmlObject)
Write
XmlObject to stream and replace xml-fragment with QName. |
protected void |
writeXmlObject(org.apache.xmlbeans.XmlObject xmlObject,
javax.xml.namespace.QName qname)
Write
XmlObject to stream and replace xml-fragment with QName. |
protected static final java.lang.String XML_FRAGMENT
public XmlStreamWriter(EncodingContext context, java.io.OutputStream outputStream, S element) throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected S getElement()
protected org.apache.xmlbeans.XmlOptions getXmlOptions()
protected java.io.OutputStream getOutputStream()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - if the flush failsprotected EncodingContext getContext()
protected void attr(javax.xml.namespace.QName name,
java.lang.String value)
throws javax.xml.stream.XMLStreamException
name - Attribute namevalue - Attribute valuejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void attr(java.lang.String name,
java.lang.String value)
throws javax.xml.stream.XMLStreamException
name - Attribute namevalue - Attribute valuejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void attr(java.lang.String namespace,
java.lang.String localName,
java.lang.String value)
throws javax.xml.stream.XMLStreamException
namespace - namespace of the attribute namelocalName - LocalName of the attribute namevalue - Attribute valuejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void namespace(java.lang.String prefix,
java.lang.String namespace)
throws javax.xml.stream.XMLStreamException
prefix - Namespace prefixnamespace - Namespace URIjavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void start(javax.xml.namespace.QName name)
throws javax.xml.stream.XMLStreamException
name - Element namejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void start()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void empty(javax.xml.namespace.QName name)
throws javax.xml.stream.XMLStreamException
name - Element namejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void chars(java.lang.String chars)
throws javax.xml.stream.XMLStreamException
chars - Characters to writejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void chars(java.lang.String chars,
boolean escape)
throws javax.xml.stream.XMLStreamException
chars - Characters to writeescape - if the chars should be XML escapedjavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void end(javax.xml.namespace.QName name)
throws javax.xml.stream.XMLStreamException
name - Element namejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void end()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void endInline(javax.xml.namespace.QName name)
throws javax.xml.stream.XMLStreamException
name - Element namejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void finish()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void flush()
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreampublic abstract void write()
throws javax.xml.stream.XMLStreamException,
EncodingException
OutputStream.javax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamEncodingException - If an encoding error occursprotected void rawText(java.lang.String text)
throws javax.xml.stream.XMLStreamException
text - Text to write to streamjavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected java.lang.String getReplacement(javax.xml.namespace.QName qname)
QName.qname - QName to create replacement fromprotected void writeXmlObject(org.apache.xmlbeans.XmlObject xmlObject,
javax.xml.namespace.QName qname)
throws javax.xml.stream.XMLStreamException
XmlObject to stream and replace xml-fragment with QName.xmlObject - XmlObject to writeqname - Replacement for xml-fragmentjavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void writeXmlObject(org.apache.xmlbeans.XmlObject xmlObject)
throws javax.xml.stream.XMLStreamException
XmlObject to stream and replace xml-fragment with QName.xmlObject - XmlObject to writejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void schemaLocation(java.util.Set<SchemaLocation> schemaLocations) throws javax.xml.stream.XMLStreamException
SchemaLocations as xsi:schemaLocations attribute to stream.schemaLocations - SchemaLocations to writejavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void time(TimeInstant time) throws javax.xml.stream.XMLStreamException
TimeInstant to stream.time - TimeInstant to write to streamjavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void time(TimePosition time) throws javax.xml.stream.XMLStreamException
TimePosition as ISO 8601 to stream.time - TimePosition to write as ISO 8601 to streamjavax.xml.stream.XMLStreamException - If an error occurs when writing to OutputStreamprotected void addXlinkHrefAttr(java.lang.String value)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected void addXlinkTitleAttr(java.lang.String value)
throws javax.xml.stream.XMLStreamException
javax.xml.stream.XMLStreamExceptionprotected <T,S> java.util.Optional<Encoder<T,S>> tryGetEncoder(EncoderKey key)
EncoderKey.T - the resulting type, the "Target"S - the input type, the "Source"key - Encoder key to get encoder forprotected <T,S> Encoder<T,S> getEncoder(EncoderKey key) throws NoEncoderForKeyException
EncoderKey.T - the resulting type, the "Target"S - the input type, the "Source"key - Encoder key to get encoder forNoEncoderForKeyException - If no matching encoder was foundprotected <T,S> Encoder<T,S> getEncoder(java.lang.String namespace, java.lang.Object o) throws NoEncoderForKeyException
NoEncoderForKeyExceptionprotected <T,S> java.util.Optional<Encoder<T,S>> getEncoder()
protected boolean isAddSchemaLocation()
protected java.util.Optional<java.lang.String> getEncodeNamespace()
Copyright © 2015–2018 52°North Initiative for Geospatial Open Source Software GmbH. All rights reserved.