Package org.apache.sis.xml
Class TransformedEvent.Start
- All Implemented Interfaces:
StartElement,XMLEvent,XMLStreamConstants
- Direct Known Subclasses:
TransformingWriter.Event
- Enclosing class:
- TransformedEvent<E extends XMLEvent>
Wrapper over an element emitted during the reading or writing of an XML document.
This wrapper is used for changing the namespace and sometimes the name of the element.
The attributes may also be modified.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.sis.xml.TransformedEvent
TransformedEvent.Attr, TransformedEvent.End, TransformedEvent.NS, TransformedEvent.Start, TransformedEvent.Type -
Field Summary
FieldsModifier and TypeFieldDescriptionThe attributes, may or may not be the same than the wrapped event.The namespaces, may or may not be the same than the wrapped event.(package private) final TransformVersionThe version to export, used for wrapping namespace context.Fields inherited from class org.apache.sis.xml.TransformedEvent
event, nameFields inherited from interface javax.xml.stream.XMLStreamConstants
ATTRIBUTE, CDATA, CHARACTERS, COMMENT, DTD, END_DOCUMENT, END_ELEMENT, ENTITY_DECLARATION, ENTITY_REFERENCE, NAMESPACE, NOTATION_DECLARATION, PROCESSING_INSTRUCTION, SPACE, START_DOCUMENT, START_ELEMENT -
Constructor Summary
ConstructorsConstructorDescriptionStart(StartElement event, QName name, List<Namespace> namespaces, List<Attribute> attributes, TransformVersion version) Wraps the given event with potentially different name, namespaces and attributes. -
Method Summary
Modifier and TypeMethodDescriptionfinal StartElementfinal AttributegetAttributeByName(QName name) Returns the attribute referred to by the given name, ornullif none.final intReturns a context mapping prefixes used in XML document to namespaces used in JAXB annotations.getNamespaceURI(String prefix) Gets the URI used by JAXB annotations for the given prefix used in the XML document.final boolean(package private) final voidwrite(Appendable out) Writes the event as per the XML 1.0 without indentation or whitespace.Methods inherited from class org.apache.sis.xml.TransformedEvent
asCharacters, asEndElement, getLocation, getName, getSchemaType, isAttribute, isCharacters, isEndDocument, isEndElement, isEntityReference, isNamespace, isProcessingInstruction, isStartDocument, name, toString, writeAsEncodedUnicodeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface javax.xml.stream.events.StartElement
getNameMethods inherited from interface javax.xml.stream.events.XMLEvent
asCharacters, asEndElement, getLocation, getSchemaType, isAttribute, isCharacters, isEndDocument, isEndElement, isEntityReference, isNamespace, isProcessingInstruction, isStartDocument, writeAsEncodedUnicode
-
Field Details
-
namespaces
The namespaces, may or may not be the same than the wrapped event. -
attributes
The attributes, may or may not be the same than the wrapped event. -
version
The version to export, used for wrapping namespace context.
-
-
Constructor Details
-
Start
Start(StartElement event, QName name, List<Namespace> namespaces, List<Attribute> attributes, TransformVersion version) Wraps the given event with potentially different name, namespaces and attributes.
-
-
Method Details
-
isStartElement
public final boolean isStartElement()- Specified by:
isStartElementin interfaceXMLEvent- Overrides:
isStartElementin classTransformedEvent<StartElement>
-
asStartElement
- Specified by:
asStartElementin interfaceXMLEvent- Overrides:
asStartElementin classTransformedEvent<StartElement>
-
getEventType
public final int getEventType()- Specified by:
getEventTypein interfaceXMLEvent
-
getNamespaces
- Specified by:
getNamespacesin interfaceStartElement
-
getAttributes
- Specified by:
getAttributesin interfaceStartElement
-
getAttributeByName
Returns the attribute referred to by the given name, ornullif none. Current implementation is okay on the assumption that there is few attributes.- Specified by:
getAttributeByNamein interfaceStartElement
-
getNamespaceURI
Gets the URI used by JAXB annotations for the given prefix used in the XML document. Returnsnullif no unique URI can be provided for the given prefix.Example: the"gmd"prefix from legacy ISO 19139:2007 standard can map to the"http://standards.iso.org/iso/19115/-3/mdb/1.0","…/cit/1.0"and other namespaces in ISO 19115-3:2016. Because of this ambiguity, this method returnsnull.At unmarshalling time, events are created by an arbitrary
XMLEventReaderwith namespaces used in the XML document.TransformingReaderwraps those events using this class for converting the XML namespaces to the namespaces used by JAXB annotations.At marshalling time, events are created by JAXB using namespaces used in JAXB annotations.
TransformingWriterwraps those events for converting those namespaces to the ones used in the XML document. This is the opposite than the work performed by this default implementation and must be handled by aStartsubclass.- Specified by:
getNamespaceURIin interfaceStartElement
-
getNamespaceContext
Returns a context mapping prefixes used in XML document to namespaces used in JAXB annotations. TheTransformingNamespaces.Inverse.getNamespaceURI(String)method in that context shall do the same work thangetNamespaceURI(String)in this event.- Specified by:
getNamespaceContextin interfaceStartElement
-
write
Writes the event as per the XML 1.0 without indentation or whitespace.- Specified by:
writein classTransformedEvent<StartElement>- Throws:
IOException
-