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 booleanReturnstrueif the given namespace is the default one.voidDo nothing if the given namespace is the default one.voidwriteAttribute(String namespaceURI, String localName, String value) Replaces the given URI if needed, then forwards the call.voidwriteAttribute(String prefix, String namespaceURI, String localName, String value) Replaces the given URI if needed, then forwards the call.voidwriteDefaultNamespace(String namespaceURI) Do nothing if the given namespace is the default one.voidwriteEmptyElement(String namespaceURI, String localName) Replaces the given URI if needed, then forwards the call.voidwriteEmptyElement(String prefix, String localName, String namespaceURI) Replaces the given URI if needed, then forwards the call.voidwriteNamespace(String prefix, String namespaceURI) Do nothing if the given namespace is the default one.voidwriteStartElement(String namespaceURI, String localName) Replaces the given URI if needed, then forwards the call.voidwriteStartElement(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
Returnstrueif the given namespace is the default one. -
writeStartElement
Replaces the given URI if needed, then forwards the call.- Specified by:
writeStartElementin interfaceXMLStreamWriter- Overrides:
writeStartElementin 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:
writeStartElementin interfaceXMLStreamWriter- Overrides:
writeStartElementin classStreamWriterDelegate- Throws:
XMLStreamException
-
writeEmptyElement
Replaces the given URI if needed, then forwards the call.- Specified by:
writeEmptyElementin interfaceXMLStreamWriter- Overrides:
writeEmptyElementin 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:
writeEmptyElementin interfaceXMLStreamWriter- Overrides:
writeEmptyElementin 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:
writeAttributein interfaceXMLStreamWriter- Overrides:
writeAttributein 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:
writeAttributein interfaceXMLStreamWriter- Overrides:
writeAttributein classStreamWriterDelegate- Throws:
XMLStreamException
-
writeNamespace
Do nothing if the given namespace is the default one.- Specified by:
writeNamespacein interfaceXMLStreamWriter- Overrides:
writeNamespacein classStreamWriterDelegate- Throws:
XMLStreamException
-
writeDefaultNamespace
Do nothing if the given namespace is the default one.- Specified by:
writeDefaultNamespacein interfaceXMLStreamWriter- Overrides:
writeDefaultNamespacein classStreamWriterDelegate- Throws:
XMLStreamException
-
setDefaultNamespace
Do nothing if the given namespace is the default one.- Specified by:
setDefaultNamespacein interfaceXMLStreamWriter- Overrides:
setDefaultNamespacein classStreamWriterDelegate- Throws:
XMLStreamException
-