org.jaxen

Class DefaultNavigator

public abstract class DefaultNavigator extends Object implements Navigator

Default implementation of Navigator.

This implementation is an abstract class, since some required operations cannot be implemented without additional knowledge of the object model.

When possible, default method implementations build upon each other, to reduce the number of methods required to be implemented for each object model. All methods, of course, may be overridden, to provide more-efficient implementations.

Author: bob mcwhirter (bob@werken.com) Erwin Bolwidt (ejb@klomp.org)

Method Summary
IteratorgetAncestorAxisIterator(Object contextNode)
IteratorgetAncestorOrSelfAxisIterator(Object contextNode)
IteratorgetAttributeAxisIterator(Object contextNode)
Throws UnsupportedAxisException.
IteratorgetChildAxisIterator(Object contextNode)
Throws UnsupportedAxisException
IteratorgetDescendantAxisIterator(Object contextNode)
IteratorgetDescendantOrSelfAxisIterator(Object contextNode)
ObjectgetDocument(String url)
Default implementation that always returns null.
ObjectgetDocumentNode(Object contextNode)
ObjectgetElementById(Object contextNode, String elementId)
Default implementation that cannot find elements.
IteratorgetFollowingAxisIterator(Object contextNode)
IteratorgetFollowingSiblingAxisIterator(Object contextNode)
IteratorgetNamespaceAxisIterator(Object contextNode)
Throws UnsupportedAxisException.
shortgetNodeType(Object node)
IteratorgetParentAxisIterator(Object contextNode)
Throws UnsupportedAxisException
ObjectgetParentNode(Object contextNode)
Default inefficient implementation.
IteratorgetPrecedingAxisIterator(Object contextNode)
IteratorgetPrecedingSiblingAxisIterator(Object contextNode)
StringgetProcessingInstructionData(Object obj)
StringgetProcessingInstructionTarget(Object obj)
IteratorgetSelfAxisIterator(Object contextNode)
StringtranslateNamespacePrefixToUri(String prefix, Object element)

Method Detail

getAncestorAxisIterator

public Iterator getAncestorAxisIterator(Object contextNode)

getAncestorOrSelfAxisIterator

public Iterator getAncestorOrSelfAxisIterator(Object contextNode)

getAttributeAxisIterator

public Iterator getAttributeAxisIterator(Object contextNode)
Throws UnsupportedAxisException. Subclasses that support the attribute axis must override this method.

Parameters: contextNode

Returns: never returns

Throws: UnsupportedAxisException

getChildAxisIterator

public Iterator getChildAxisIterator(Object contextNode)
Throws UnsupportedAxisException

Parameters: contextNode

Returns: never returns

Throws: UnsupportedAxisException always

getDescendantAxisIterator

public Iterator getDescendantAxisIterator(Object contextNode)

getDescendantOrSelfAxisIterator

public Iterator getDescendantOrSelfAxisIterator(Object contextNode)

getDocument

public Object getDocument(String url)
Default implementation that always returns null. Override in subclass if the subclass can load documents.

Parameters: url the URL of the document to load

Returns: null

Throws: FunctionCallException if an error occurs while loading the URL; e.g. an I/O error or the document is malformed

getDocumentNode

public Object getDocumentNode(Object contextNode)

getElementById

public Object getElementById(Object contextNode, String elementId)
Default implementation that cannot find elements. Override in subclass if subclass does know about attribute types.

Parameters: contextNode a node from the document in which to look for the id elementId id to look for

Returns: null

getFollowingAxisIterator

public Iterator getFollowingAxisIterator(Object contextNode)

getFollowingSiblingAxisIterator

public Iterator getFollowingSiblingAxisIterator(Object contextNode)

getNamespaceAxisIterator

public Iterator getNamespaceAxisIterator(Object contextNode)
Throws UnsupportedAxisException. Subclasses that support the namespace axis must override this method.

Parameters: contextNode

Returns: never returns

Throws: UnsupportedAxisException

getNodeType

public short getNodeType(Object node)

getParentAxisIterator

public Iterator getParentAxisIterator(Object contextNode)
Throws UnsupportedAxisException

Parameters: contextNode

Returns: never returns

Throws: UnsupportedAxisException

getParentNode

public Object getParentNode(Object contextNode)
Default inefficient implementation. Subclasses should override this method.

Parameters: contextNode the node whose parent to return

Returns: the parent node

Throws: UnsupportedAxisException if the parent axis is not supported

getPrecedingAxisIterator

public Iterator getPrecedingAxisIterator(Object contextNode)

getPrecedingSiblingAxisIterator

public Iterator getPrecedingSiblingAxisIterator(Object contextNode)

getProcessingInstructionData

public String getProcessingInstructionData(Object obj)

getProcessingInstructionTarget

public String getProcessingInstructionTarget(Object obj)

getSelfAxisIterator

public Iterator getSelfAxisIterator(Object contextNode)

translateNamespacePrefixToUri

public String translateNamespacePrefixToUri(String prefix, Object element)