S - object to writepublic abstract class XmlStreamWriter<S> extends Object
| Modifier and Type | Field and Description |
|---|---|
protected static String |
XML_FRAGMENT |
| Constructor and Description |
|---|
XmlStreamWriter(EncodingContext context,
OutputStream outputStream,
S element) |
| Modifier and Type | Method and Description |
|---|---|
protected void |
addXlinkHrefAttr(String value) |
protected void |
addXlinkTitleAttr(String value) |
protected void |
attr(QName name,
String value)
Write attribute to stream.
|
protected void |
attr(String name,
String value)
Write attribute to stream.
|
protected void |
attr(String namespace,
String localName,
String value)
Write attribute to stream.
|
protected void |
chars(String chars)
Write characters to stream.
|
protected void |
chars(String chars,
boolean escape)
Write characters to stream.
|
protected void |
empty(QName name)
Write an empty element to stream.
|
protected void |
end()
Write the document end to stream.
|
protected void |
end(QName name)
Write the end element to new line.
|
protected void |
endInline(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 Optional<String> |
getEncodeNamespace() |
protected <T,S> 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(String namespace,
Object o) |
protected OutputStream |
getOutputStream()
Get the underlying output stream.
|
protected String |
getReplacement(QName qname)
Create the replacement from
QName. |
protected org.apache.xmlbeans.XmlOptions |
getXmlOptions()
Get the XML options.
|
protected boolean |
isAddSchemaLocation() |
protected void |
namespace(String prefix,
String namespace)
Write namespace to stream.
|
protected void |
rawText(String text)
Write raw text to stream an adds current indent before writing the text (and before each subsequent line).
|
protected void |
schemaLocation(Set<org.n52.shetland.w3c.SchemaLocation> schemaLocations)
Write
SchemaLocations as xsi:schemaLocations attribute to stream. |
protected void |
start()
Write document start to stream with or without.
|
protected void |
start(QName name)
Write start element to stream.
|
protected void |
time(org.n52.shetland.ogc.gml.time.TimeInstant time)
Write
TimeInstant to stream. |
protected void |
time(org.n52.shetland.ogc.gml.time.TimePosition time)
Write
TimePosition as ISO 8601 to stream. |
protected <T,S> 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,
QName qname)
Write
XmlObject to stream and replace xml-fragment with QName. |
protected static final String XML_FRAGMENT
public XmlStreamWriter(EncodingContext context, OutputStream outputStream, S element) throws XMLStreamException
XMLStreamExceptionprotected S getElement()
protected org.apache.xmlbeans.XmlOptions getXmlOptions()
protected OutputStream getOutputStream() throws XMLStreamException
XMLStreamException - if the flush failsprotected EncodingContext getContext()
protected void attr(QName name, String value) throws XMLStreamException
name - Attribute namevalue - Attribute valueXMLStreamException - If an error occurs when writing to OutputStreamprotected void attr(String name, String value) throws XMLStreamException
name - Attribute namevalue - Attribute valueXMLStreamException - If an error occurs when writing to OutputStreamprotected void attr(String namespace, String localName, String value) throws XMLStreamException
namespace - namespace of the attribute namelocalName - LocalName of the attribute namevalue - Attribute valueXMLStreamException - If an error occurs when writing to OutputStreamprotected void namespace(String prefix, String namespace) throws XMLStreamException
prefix - Namespace prefixnamespace - Namespace URIXMLStreamException - If an error occurs when writing to OutputStreamprotected void start(QName name) throws XMLStreamException
name - Element nameXMLStreamException - If an error occurs when writing to OutputStreamprotected void start()
throws XMLStreamException
XMLStreamException - If an error occurs when writing to OutputStreamprotected void empty(QName name) throws XMLStreamException
name - Element nameXMLStreamException - If an error occurs when writing to OutputStreamprotected void chars(String chars) throws XMLStreamException
chars - Characters to writeXMLStreamException - If an error occurs when writing to OutputStreamprotected void chars(String chars, boolean escape) throws XMLStreamException
chars - Characters to writeescape - if the chars should be XML escapedXMLStreamException - If an error occurs when writing to OutputStreamprotected void end(QName name) throws XMLStreamException
name - Element nameXMLStreamException - If an error occurs when writing to OutputStreamprotected void end()
throws XMLStreamException
XMLStreamException - If an error occurs when writing to OutputStreamprotected void endInline(QName name) throws XMLStreamException
name - Element nameXMLStreamException - If an error occurs when writing to OutputStreamprotected void finish()
throws XMLStreamException
XMLStreamException - If an error occurs when writing to OutputStreamprotected void flush()
throws XMLStreamException
XMLStreamException - If an error occurs when writing to OutputStreampublic abstract void write()
throws XMLStreamException,
EncodingException
OutputStream.XMLStreamException - If an error occurs when writing to OutputStreamEncodingException - If an encoding error occursprotected void rawText(String text) throws XMLStreamException
text - Text to write to streamXMLStreamException - If an error occurs when writing to OutputStreamprotected String getReplacement(QName qname)
QName.qname - QName to create replacement fromprotected void writeXmlObject(org.apache.xmlbeans.XmlObject xmlObject,
QName qname)
throws XMLStreamException
XmlObject to stream and replace xml-fragment with QName.xmlObject - XmlObject to writeqname - Replacement for xml-fragmentXMLStreamException - If an error occurs when writing to OutputStreamprotected void writeXmlObject(org.apache.xmlbeans.XmlObject xmlObject)
throws XMLStreamException
XmlObject to stream and replace xml-fragment with QName.xmlObject - XmlObject to writeXMLStreamException - If an error occurs when writing to OutputStreamprotected void schemaLocation(Set<org.n52.shetland.w3c.SchemaLocation> schemaLocations) throws XMLStreamException
SchemaLocations as xsi:schemaLocations attribute to stream.schemaLocations - SchemaLocations to writeXMLStreamException - If an error occurs when writing to OutputStreamprotected void time(org.n52.shetland.ogc.gml.time.TimeInstant time)
throws XMLStreamException
TimeInstant to stream.time - TimeInstant to write to streamXMLStreamException - If an error occurs when writing to OutputStreamprotected void time(org.n52.shetland.ogc.gml.time.TimePosition time)
throws XMLStreamException
TimePosition as ISO 8601 to stream.time - TimePosition to write as ISO 8601 to streamXMLStreamException - If an error occurs when writing to OutputStreamprotected void addXlinkHrefAttr(String value) throws XMLStreamException
XMLStreamExceptionprotected void addXlinkTitleAttr(String value) throws XMLStreamException
XMLStreamExceptionprotected <T,S> 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(String namespace, Object o) throws NoEncoderForKeyException
NoEncoderForKeyExceptionprotected boolean isAddSchemaLocation()
Copyright © 2016–2017 52°North Initiative for Geospatial Open Source Software GmbH. All rights reserved.