Package nl.vpro.xml.util
Class XMLStreamWriterUtil
- java.lang.Object
-
- nl.vpro.xml.util.XMLStreamWriterUtil
-
public class XMLStreamWriterUtil extends Object
A wrapper aroundXMLStreamWriter
, which usesAutoCloseable
to automatically close the needed elements.- Since:
- 2.8
- Author:
- Michiel Meeuwissen
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description class
XMLStreamWriterUtil.ElementCloser
-
Constructor Summary
Constructors Constructor Description XMLStreamWriterUtil(OutputStream outputStream)
XMLStreamWriterUtil(Writer writer)
XMLStreamWriterUtil(StringBuilder builder)
XMLStreamWriterUtil(XMLStreamWriter writer)
-
Method Summary
-
-
-
Constructor Detail
-
XMLStreamWriterUtil
public XMLStreamWriterUtil(XMLStreamWriter writer)
-
XMLStreamWriterUtil
public XMLStreamWriterUtil(OutputStream outputStream) throws XMLStreamException
- Throws:
XMLStreamException
-
XMLStreamWriterUtil
public XMLStreamWriterUtil(Writer writer) throws XMLStreamException
- Throws:
XMLStreamException
-
XMLStreamWriterUtil
public XMLStreamWriterUtil(StringBuilder builder) throws XMLStreamException
- Throws:
XMLStreamException
-
-
Method Detail
-
writeElement
public XMLStreamWriterUtil.ElementCloser writeElement(String name) throws XMLStreamException
- Throws:
XMLStreamException
-
writeElement
public XMLStreamWriterUtil.ElementCloser writeElement(String namespace, String name) throws XMLStreamException
- Throws:
XMLStreamException
-
writeDocument
public XMLStreamWriterUtil.ElementCloser writeDocument() throws XMLStreamException
- Throws:
XMLStreamException
-
writeDocument
public XMLStreamWriterUtil.ElementCloser writeDocument(String version) throws XMLStreamException
- Throws:
XMLStreamException
-
writeDocument
public XMLStreamWriterUtil.ElementCloser writeDocument(Charset charset, String version) throws XMLStreamException
- Throws:
XMLStreamException
-
writeEmptyElement
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException
- Throws:
XMLStreamException
-
writeEmptyElement
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException
- Throws:
XMLStreamException
-
writeEmptyElement
public void writeEmptyElement(String localName) throws XMLStreamException
- Throws:
XMLStreamException
-
close
public void close() throws XMLStreamException
- Throws:
XMLStreamException
-
flush
public void flush() throws XMLStreamException
- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String localName, String value) throws XMLStreamException
- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException
- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException
- Throws:
XMLStreamException
-
writeNamespace
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException
- Throws:
XMLStreamException
-
writeDefaultNamespace
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException
- Throws:
XMLStreamException
-
writeComment
public void writeComment(String data) throws XMLStreamException
- Throws:
XMLStreamException
-
writeProcessingInstruction
public void writeProcessingInstruction(String target) throws XMLStreamException
- Throws:
XMLStreamException
-
writeProcessingInstruction
public void writeProcessingInstruction(String target, String data) throws XMLStreamException
- Throws:
XMLStreamException
-
writeCData
public void writeCData(String data) throws XMLStreamException
- Throws:
XMLStreamException
-
writeDTD
public void writeDTD(String dtd) throws XMLStreamException
- Throws:
XMLStreamException
-
writeEntityRef
public void writeEntityRef(String name) throws XMLStreamException
- Throws:
XMLStreamException
-
writeCharacters
public void writeCharacters(String text) throws XMLStreamException
- Throws:
XMLStreamException
-
writeCharacters
public void writeCharacters(char[] text, int start, int len) throws XMLStreamException
- Throws:
XMLStreamException
-
getPrefix
public String getPrefix(String uri) throws XMLStreamException
- Throws:
XMLStreamException
-
setPrefix
public void setPrefix(String prefix, String uri) throws XMLStreamException
- Throws:
XMLStreamException
-
setDefaultNamespace
public void setDefaultNamespace(String uri) throws XMLStreamException
- Throws:
XMLStreamException
-
setNamespaceContext
public void setNamespaceContext(NamespaceContext context) throws XMLStreamException
- Throws:
XMLStreamException
-
getNamespaceContext
public NamespaceContext getNamespaceContext()
-
getProperty
public Object getProperty(String name) throws IllegalArgumentException
- Throws:
IllegalArgumentException
-
-