📄 navigator.java
字号:
* * @see #isDocument * @see #isElement * * @param contextNode the context node * * @return the parent of the context node, or null if this is a document node. * * @throws UnsupportedAxisException if the parent axis is not * supported by the model */ Object getParentNode(Object contextNode) throws UnsupportedAxisException; /** Retrieve the namespace URI of the given element node. * * @param element the context element node * * @return the namespace URI of the element node */ String getElementNamespaceUri(Object element); /** Retrieve the local name of the given element node. * * @param element the context element node * * @return the local name of the element node */ String getElementName(Object element); /** Retrieve the qualified name of the given element node. * * @param element the context element node * * @return the qualified name of the element node */ String getElementQName(Object element); /** Retrieve the namespace URI of the given attribute node. * * @param attr the context attribute node * * @return the namespace URI of the attribute node */ String getAttributeNamespaceUri(Object attr); /** Retrieve the local name of the given attribute node. * * @param attr the context attribute node * * @return the local name of the attribute node */ String getAttributeName(Object attr); /** Retrieve the qualified name of the given attribute node. * * @param attr the context attribute node * * @return the qualified name of the attribute node */ String getAttributeQName(Object attr); /** Retrieve the target of a processing-instruction. * * @param pi the context processing-instruction node * * @return the target of the processing-instruction node */ String getProcessingInstructionTarget(Object pi); /** Retrieve the data of a processing-instruction. * * @param pi the context processing-instruction node * * @return the data of the processing-instruction node */ String getProcessingInstructionData(Object pi); // ---------------------------------------------------------------------- // isXXX testers // ---------------------------------------------------------------------- /** Returns whether the given object is a document node. A document node * is the node that is selected by the XPath expression <code>/</code>. * * @param object the object to test * * @return <code>true</code> if the object is a document node, * else <code>false</code> */ boolean isDocument(Object object); /** Returns whether the given object is an element node. * * @param object the object to test * * @return <code>true</code> if the object is an element node, * else <code>false</code> */ boolean isElement(Object object); /** Returns whether the given object is an attribute node. * * @param object the object to test * * @return <code>true</code> if the object is an attribute node, * else <code>false</code> */ boolean isAttribute(Object object); /** Returns whether the given object is a namespace node. * * @param object the object to test * * @return <code>true</code> if the object is a namespace node, * else <code>false</code> */ boolean isNamespace(Object object); /** Returns whether the given object is a comment node. * * @param object the object to test * * @return <code>true</code> if the object is a comment node, * else <code>false</code> */ boolean isComment(Object object); /** Returns whether the given object is a text node. * * @param object the object to test * * @return <code>true</code> if the object is a text node, * else <code>false</code> */ boolean isText(Object object); /** Returns whether the given object is a processing-instruction node. * * @param object the object to test * * @return <code>true</code> if the object is a processing-instruction node, * else <code>false</code> */ boolean isProcessingInstruction(Object object); // ---------------------------------------------------------------------- // String-Value extractors // ---------------------------------------------------------------------- /** Retrieve the string-value of a comment node. * This may be the empty string if the comment is empty, * but must not be null. * * @param comment the comment node * * @return the string-value of the node */ String getCommentStringValue(Object comment); /** Retrieve the string-value of an element node. * This may be the empty string if the element is empty, * but must not be null. * * @param element the comment node. * * @return the string-value of the node. */ String getElementStringValue(Object element); /** Retrieve the string-value of an attribute node. * This should be the XML 1.0 normalized attribute value. * This may be the empty string but must not be null. * * @param attr the attribute node * * @return the string-value of the node */ String getAttributeStringValue(Object attr); /** Retrieve the string-value of a namespace node. * This is generally the namespace URI. * This may be the empty string but must not be null. * * @param ns the namespace node * * @return the string-value of the node */ String getNamespaceStringValue(Object ns); /** Retrieve the string-value of a text node. * This must not be null and should not be the empty string. * The XPath data model does not allow empty text nodes. * * @param text the text node * * @return the string-value of the node */ String getTextStringValue(Object text); // ---------------------------------------------------------------------- // General utilities // ---------------------------------------------------------------------- /** Retrieve the namespace prefix of a namespace node. * * @param ns the namespace node * * @return the prefix associated with the node */ String getNamespacePrefix(Object ns); /** Translate a namespace prefix to a namespace URI, <strong>possibly</strong> * considering a particular element node. * * <p> * Strictly speaking, prefix-to-URI translation should occur * irrespective of any element in the document. This method * is provided to allow a non-conforming ease-of-use enhancement. * </p> * * @see NamespaceContext * * @param prefix the prefix to translate * @param element the element to consider during translation * * @return the namespace URI associated with the prefix */ String translateNamespacePrefixToUri(String prefix, Object element); /** Returns a parsed form of the given XPath string, which will be suitable * for queries on documents that use the same navigator as this one. * * @see XPath * * @param xpath the XPath expression * * @return a new XPath expression object * * @throws SAXPathException if the string is not a syntactically * correct XPath expression */ XPath parseXPath(String xpath) throws SAXPathException; /** * Returns the element whose ID is given by elementId. * If no such element exists, returns null. * Attributes with the name "ID" are not of type ID unless so defined. * Implementations that do not know whether attributes are of type ID or * not are expected to return null. * * @param contextNode a node from the document in which to look for the * id * @param elementId id to look for * * @return element whose ID is given by elementId, or null if no such * element exists in the document or if the implementation * does not know about attribute types */ Object getElementById(Object contextNode, String elementId); /** Returns a number that identifies the type of node that the given * object represents in this navigator. * * @param node ???? * @return ???? * * @see org.jaxen.pattern.Pattern */ short getNodeType(Object node);}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -