public final class XmlEventWriter extends Object implements XMLEventWriter
Constructor and Description |
---|
XmlEventWriter(Writer baos,
String defaultPrefix,
boolean includeXMLDeclaration,
String rootElement) |
Modifier and Type | Method and Description |
---|---|
void |
add(XMLEvent event) |
void |
add(XMLEventReader arg0) |
void |
close() |
void |
flush() |
String |
getDefaultPrefix() |
NamespaceContext |
getNamespaceContext() |
Map<String,String> |
getPeferredPrefixes() |
String |
getPrefix(String arg0) |
String |
getRootElement() |
boolean |
isIncludeXMLDeclaration() |
void |
setDefaultNamespace(String arg0) |
void |
setDefaultPrefix(String defaultPrefix) |
void |
setIncludeXMLDeclaration(boolean includeXMLDeclaration) |
void |
setNamespaceContext(NamespaceContext arg0) |
void |
setPeferredPrefixes(Map<String,String> peferredPrefixes)
Custom optional prefix configuration, if provided, this prefixes will
be used regardless of any other context namespaces and prefix configuration.
|
void |
setPrefix(String arg0,
String arg1) |
void |
setRootElement(String rootElement) |
public XmlEventWriter(Writer baos, String defaultPrefix, boolean includeXMLDeclaration, String rootElement)
baos
- output buffer to writedefaultPrefix
- optional prefix (empty by default) to used for all elements that are not binded to a specific prefixincludeXMLDeclaration
- true to include the XML declaration (true by default)rootElement
- local name of the root element of the XML fragment to create, used to declare namespacesetPeferredPrefixes(Map)
public void add(XMLEvent event) throws XMLStreamException
add
in interface XMLEventConsumer
add
in interface XMLEventWriter
XMLStreamException
public void add(XMLEventReader arg0) throws XMLStreamException
add
in interface XMLEventWriter
XMLStreamException
public void close() throws XMLStreamException
close
in interface XMLEventWriter
XMLStreamException
public void flush() throws XMLStreamException
flush
in interface XMLEventWriter
XMLStreamException
public NamespaceContext getNamespaceContext()
getNamespaceContext
in interface XMLEventWriter
public String getPrefix(String arg0) throws XMLStreamException
getPrefix
in interface XMLEventWriter
XMLStreamException
public void setDefaultNamespace(String arg0) throws XMLStreamException
setDefaultNamespace
in interface XMLEventWriter
XMLStreamException
public void setNamespaceContext(NamespaceContext arg0) throws XMLStreamException
setNamespaceContext
in interface XMLEventWriter
XMLStreamException
public void setPrefix(String arg0, String arg1) throws XMLStreamException
setPrefix
in interface XMLEventWriter
XMLStreamException
public String getDefaultPrefix()
public void setDefaultPrefix(String defaultPrefix)
public void setPeferredPrefixes(Map<String,String> peferredPrefixes)
peferredPrefixes
- a map with namespaceURIs as keys and prefixes as valuespublic boolean isIncludeXMLDeclaration()
public void setIncludeXMLDeclaration(boolean includeXMLDeclaration)
public String getRootElement()
public void setRootElement(String rootElement)