Package org.apache.axiom.om
Interface QNameAwareOMDataSource
-
- All Superinterfaces:
OMDataSource
- All Known Implementing Classes:
JAXBOMDataSource
,WrappedTextNodeOMDataSource
,WrappedTextNodeOMDataSourceFromDataSource
,WrappedTextNodeOMDataSourceFromReader
public interface QNameAwareOMDataSource extends OMDataSource
Optional interface implemented byOMDataSource
implementations that have knowledge about the local name, namespace URI and/or namespace prefix of the element they represent. This interface is used byOMSourcedElement
to lazily determine the name of the element without expanding it. The information returned by the implementation may be partial; e.g. the data source may know about the local name and namespace URI but it may be unable to predict the namespace prefix. The returned information must be accurate, i.e. it must match the name of the root element in the document returned byOMDataSource.getReader()
.This interface should be implemented by
OMDataSource
implementations that have an efficient way to determine the root element name (or part of it) from the information effectively used byOMDataSource.getReader()
to construct theXMLStreamReader
instance. In practice this applies toOMDataSource
implementations that satisfy one of the following conditions:- The data source wraps another type of object and is able to determine the element name from that object in an efficient way. E.g. this is often the case if the data source uses a Java-to-XML mapping framework to transform the wrapped object into XML.
- The QName of the element is configurable and supplied by the application code when the data source is instantiated.
OMDataSource.getReader()
actually using that information). In fact, in this case the application code should useOMFactory.createOMElement(OMDataSource, String, OMNamespace)
orOMFactory.createOMElement(OMDataSource, QName)
to supply the QName information it has.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
getLocalName()
Get the local name of the element represented by this data source.String
getNamespaceURI()
Get the namespace URI of the element represented by this data source.String
getPrefix()
Get the namespace prefix of the element represented by this data source.-
Methods inherited from interface org.apache.axiom.om.OMDataSource
getReader, serialize, serialize, serialize
-
-
-
-
Method Detail
-
getLocalName
String getLocalName()
Get the local name of the element represented by this data source.- Returns:
- the local name of the element or
null
if the local name is not known
-
getNamespaceURI
String getNamespaceURI()
Get the namespace URI of the element represented by this data source.- Returns:
- the namespace URI of the element, the empty string if the element has no namespace or
null
if the namespace URI is not known
-
getPrefix
String getPrefix()
Get the namespace prefix of the element represented by this data source.- Returns:
- the prefix of the element, the empty string if the element has no prefix or
null
if the prefix is not known; the implementation is expected to return an empty string ifgetNamespaceURI()
returns an empty string (because an element without namespace must not have a prefix)
-
-