org.apache.axiom.om
Interface QNameAwareOMDataSource

All Superinterfaces:
OMDataSource
All Known Implementing Classes:
JAXBOMDataSource, PushOMDataSource, WrappedTextNodeOMDataSource, WrappedTextNodeOMDataSourceFromDataSource, WrappedTextNodeOMDataSourceFromReader

public interface QNameAwareOMDataSource
extends OMDataSource

Optional interface implemented by OMDataSource implementations that have knowledge about the local name, namespace URI and/or namespace prefix of the element they represent. This interface is used by OMSourcedElement 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 by OMDataSource.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 by OMDataSource.getReader() to construct the XMLStreamReader instance. In practice this applies to OMDataSource implementations that satisfy one of the following conditions:

This interface should not be implemented if the returned information would be supplied by the application code when the data source is instantiate, without the data source being able to guarantee that the information is accurate (i.e. without OMDataSource.getReader() actually using that information). In fact, in this case the application code should use OMFactory.createOMElement(OMDataSource, String, OMNamespace) or OMFactory.createOMElement(OMDataSource, QName) to supply the QName information it has.


Method Summary
 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 if getNamespaceURI() returns an empty string (because an element without namespace must not have a prefix)


Copyright © 2004-2012 The Apache Software Foundation. All Rights Reserved.