Class NamespaceEraser
java.lang.Object
org.apache.sis.internal.xml.StreamWriterDelegate
org.apache.sis.internal.storage.xml.stream.NamespaceEraser
- All Implemented Interfaces:
XMLStreamWriter
A filter replacing the given namespace by the default namespace.
This is used for removing unnecessary namespace declarations introduced by JAXB marshaller.
- Since:
- 0.8
- Version:
- 0.8
-
Field Summary
FieldsFields inherited from class org.apache.sis.internal.xml.StreamWriterDelegate
out
-
Constructor Summary
ConstructorsConstructorDescriptionNamespaceEraser
(XMLStreamWriter out, String namespaceURI) Creates a new filter for the given default namespace. -
Method Summary
Modifier and TypeMethodDescriptionprivate boolean
Returnstrue
if the given namespace is the default one.void
Do nothing if the given namespace is the default one.void
writeAttribute
(String namespaceURI, String localName, String value) Replaces the given URI if needed, then forwards the call.void
writeAttribute
(String prefix, String namespaceURI, String localName, String value) Replaces the given URI if needed, then forwards the call.void
writeDefaultNamespace
(String namespaceURI) Do nothing if the given namespace is the default one.void
writeEmptyElement
(String namespaceURI, String localName) Replaces the given URI if needed, then forwards the call.void
writeEmptyElement
(String prefix, String localName, String namespaceURI) Replaces the given URI if needed, then forwards the call.void
writeNamespace
(String prefix, String namespaceURI) Do nothing if the given namespace is the default one.void
writeStartElement
(String namespaceURI, String localName) Replaces the given URI if needed, then forwards the call.void
writeStartElement
(String prefix, String localName, String namespaceURI) Replaces the given URI if needed, then forwards the call.Methods inherited from class org.apache.sis.internal.xml.StreamWriterDelegate
close, flush, getNamespaceContext, getPrefix, getProperty, setNamespaceContext, setPrefix, writeAttribute, writeCData, writeCharacters, writeCharacters, writeComment, writeDTD, writeEmptyElement, writeEndDocument, writeEndElement, writeEntityRef, writeProcessingInstruction, writeProcessingInstruction, writeStartDocument, writeStartDocument, writeStartDocument, writeStartElement
-
Field Details
-
defaultNamespace
The default namespace.
-
-
Constructor Details
-
NamespaceEraser
NamespaceEraser(XMLStreamWriter out, String namespaceURI) Creates a new filter for the given default namespace.
-
-
Method Details
-
isDefault
Returnstrue
if the given namespace is the default one. -
writeStartElement
Replaces the given URI if needed, then forwards the call.- Specified by:
writeStartElement
in interfaceXMLStreamWriter
- Overrides:
writeStartElement
in classStreamWriterDelegate
- Throws:
XMLStreamException
-
writeStartElement
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException Replaces the given URI if needed, then forwards the call.- Specified by:
writeStartElement
in interfaceXMLStreamWriter
- Overrides:
writeStartElement
in classStreamWriterDelegate
- Throws:
XMLStreamException
-
writeEmptyElement
Replaces the given URI if needed, then forwards the call.- Specified by:
writeEmptyElement
in interfaceXMLStreamWriter
- Overrides:
writeEmptyElement
in classStreamWriterDelegate
- Throws:
XMLStreamException
-
writeEmptyElement
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException Replaces the given URI if needed, then forwards the call.- Specified by:
writeEmptyElement
in interfaceXMLStreamWriter
- Overrides:
writeEmptyElement
in classStreamWriterDelegate
- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException Replaces the given URI if needed, then forwards the call.- Specified by:
writeAttribute
in interfaceXMLStreamWriter
- Overrides:
writeAttribute
in classStreamWriterDelegate
- Throws:
XMLStreamException
-
writeAttribute
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException Replaces the given URI if needed, then forwards the call.- Specified by:
writeAttribute
in interfaceXMLStreamWriter
- Overrides:
writeAttribute
in classStreamWriterDelegate
- Throws:
XMLStreamException
-
writeNamespace
Do nothing if the given namespace is the default one.- Specified by:
writeNamespace
in interfaceXMLStreamWriter
- Overrides:
writeNamespace
in classStreamWriterDelegate
- Throws:
XMLStreamException
-
writeDefaultNamespace
Do nothing if the given namespace is the default one.- Specified by:
writeDefaultNamespace
in interfaceXMLStreamWriter
- Overrides:
writeDefaultNamespace
in classStreamWriterDelegate
- Throws:
XMLStreamException
-
setDefaultNamespace
Do nothing if the given namespace is the default one.- Specified by:
setDefaultNamespace
in interfaceXMLStreamWriter
- Overrides:
setDefaultNamespace
in classStreamWriterDelegate
- Throws:
XMLStreamException
-