⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 node.java

📁 解决如何把XML应用到JAVA里问题
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
     *            context is null or the context is not an ancestor of this node
     *            then the path will start from the document and so begin with
     *            the '/' character.
     * 
     * @return the XPath expression relative to the given context which will
     *         return a nodeset containing just this node.
     */
    String getUniquePath(Element context);

    /**
     * <p>
     * <code>asXML</code> returns the textual XML representation of this node.
     * </p>
     * 
     * @return the XML representation of this node
     */
    String asXML();

    /**
     * <p>
     * <code>write</code> writes this node as the default XML notation for
     * this node. If you wish to control the XML output (such as for pretty
     * printing, changing the indentation policy etc.) then please use {@link
     * org.dom4j.io.XMLWriter} or its derivations.
     * </p>
     * 
     * @param writer
     *            is the <code>Writer</code> to output the XML to
     * 
     * @throws IOException
     *             DOCUMENT ME!
     */
    void write(Writer writer) throws IOException;

    /**
     * Returns the code according to the type of node. This makes processing
     * nodes polymorphically much easier as the switch statement can be used
     * instead of multiple if (instanceof) statements.
     * 
     * @return a W3C DOM complient code for the node type such as ELEMENT_NODE
     *         or ATTRIBUTE_NODE
     */
    short getNodeType();

    /**
     * DOCUMENT ME!
     * 
     * @return the name of the type of node such as "Document", "Element",
     *         "Attribute" or "Text"
     */
    String getNodeTypeName();

    /**
     * <p>
     * Removes this node from its parent if there is one. If this node is the
     * root element of a document then it is removed from the document as well.
     * </p>
     * 
     * <p>
     * This method is useful if you want to remove a node from its source
     * document and add it to another document. For example
     * </p>
     * <code> Node node = ...; Element someOtherElement = ...;
     * someOtherElement.add( node.detach() ); </code>
     * 
     * @return the node that has been removed from its parent node if any and
     *         its document if any.
     */
    Node detach();

    /**
     * <p>
     * <code>selectNodes</code> evaluates an XPath expression and returns the
     * result as a <code>List</code> of <code>Node</code> instances or
     * <code>String</code> instances depending on the XPath expression.
     * </p>
     * 
     * @param xpathExpression
     *            is the XPath expression to be evaluated
     * 
     * @return the list of <code>Node</code> or <code>String</code>
     *         instances depending on the XPath expression
     */
    List selectNodes(String xpathExpression);

    /**
     * <p>
     * <code>selectObject</code> evaluates an XPath expression and returns the
     * result as an {@link Object}. The object returned can either be a {@link
     * List} of one or more {@link Node}instances or a scalar object like a
     * {@link String}or a {@link Number}instance depending on the XPath
     * expression.
     * </p>
     * 
     * @param xpathExpression
     *            is the XPath expression to be evaluated
     * 
     * @return the value of the XPath expression as a {@link List}of {@link
     *         Node} instances, a {@link String}or a {@link Number}instance
     *         depending on the XPath expression.
     */
    Object selectObject(String xpathExpression);

    /**
     * <p>
     * <code>selectNodes</code> evaluates an XPath expression then sorts the
     * results using a secondary XPath expression Returns a sorted
     * <code>List</code> of <code>Node</code> instances.
     * </p>
     * 
     * @param xpathExpression
     *            is the XPath expression to be evaluated
     * @param comparisonXPathExpression
     *            is the XPath expression used to compare the results by for
     *            sorting
     * 
     * @return the list of <code>Node</code> instances sorted by the
     *         comparisonXPathExpression
     */
    List selectNodes(String xpathExpression, String comparisonXPathExpression);

    /**
     * <p>
     * <code>selectNodes</code> evaluates an XPath expression then sorts the
     * results using a secondary XPath expression Returns a sorted
     * <code>List</code> of <code>Node</code> instances.
     * </p>
     * 
     * @param xpathExpression
     *            is the XPath expression to be evaluated
     * @param comparisonXPathExpression
     *            is the XPath expression used to compare the results by for
     *            sorting
     * @param removeDuplicates
     *            if this parameter is true then duplicate values (using the
     *            comparisonXPathExpression) are removed from the result List.
     * 
     * @return the list of <code>Node</code> instances sorted by the
     *         comparisonXPathExpression
     */
    List selectNodes(String xpathExpression, String comparisonXPathExpression,
            boolean removeDuplicates);

    /**
     * <p>
     * <code>selectSingleNode</code> evaluates an XPath expression and returns
     * the result as a single <code>Node</code> instance.
     * </p>
     * 
     * @param xpathExpression
     *            is the XPath expression to be evaluated
     * 
     * @return the <code>Node</code> matching the XPath expression
     */
    Node selectSingleNode(String xpathExpression);

    /**
     * <p>
     * <code>valueOf</code> evaluates an XPath expression and returns the
     * textual representation of the results the XPath string-value of this
     * node. The string-value for a given node type is defined in the <a
     * href="http://www.w3.org/TR/xpath">XPath specification </a>.
     * </p>
     * 
     * @param xpathExpression
     *            is the XPath expression to be evaluated
     * 
     * @return the string-value representation of the results of the XPath
     *         expression
     */
    String valueOf(String xpathExpression);

    /**
     * <p>
     * <code>numberValueOf</code> evaluates an XPath expression and returns
     * the numeric value of the XPath expression if the XPath expression results
     * in a number, or null if the result is not a number.
     * </p>
     * 
     * @param xpathExpression
     *            is the XPath expression to be evaluated
     * 
     * @return the numeric result of the XPath expression or null if the result
     *         is not a number.
     */
    Number numberValueOf(String xpathExpression);

    /**
     * <p>
     * <code>matches</code> returns true if evaluating the given XPath
     * expression on this node returns a non-empty node set containing this
     * node.
     * </p>
     * 
     * <p>
     * This method does not behave like the &lt;xsl:if&gt; element - if you want
     * that behaviour, to evaluate if an XPath expression matches something,
     * then you can use the following code to be equivalent...
     * </p>
     * <code>if ( node.selectSingleNode( "/some/path" ) != nulll )</code>
     * 
     * @param xpathExpression
     *            is an XPath expression
     * 
     * @return true if this node is returned by the given XPath expression
     */
    boolean matches(String xpathExpression);

    /**
     * <p>
     * <code>createXPath</code> creates an XPath object for the given
     * xpathExpression. The XPath object allows the variable context to be
     * specified.
     * </p>
     * 
     * @param xpathExpression
     *            is the XPath expression to be evaluated
     * 
     * @return an XPath object represeting the given expression
     * 
     * @throws InvalidXPathException
     *             if the XPath expression is invalid
     */
    XPath createXPath(String xpathExpression) throws InvalidXPathException;

    /**
     * <p>
     * <code>asXPathResult</code> returns a version of this node which is
     * capable of being an XPath result. The result of an XPath expression
     * should always support the parent relationship, whether the original XML
     * tree was singly or doubly linked. If the node does not support the parent
     * relationship then a new node will be created which is linked to its
     * parent and returned.
     * </p>
     * 
     * @param parent
     *            DOCUMENT ME!
     * 
     * @return a <code>Node</code> which supports the parent relationship
     */
    Node asXPathResult(Element parent);

    /**
     * <p>
     * <code>accept</code> is the method used in the Visitor Pattern.
     * </p>
     * 
     * @param visitor
     *            is the visitor in the Visitor Pattern
     */
    void accept(Visitor visitor);

    /**
     * <p>
     * <code>clone</code> will return a deep clone or if this node is
     * read-only then clone will return the same instance.
     * </p>
     * 
     * @return a deep clone of myself or myself if I am read only.
     */
    Object clone();
}

/*
 * Redistribution and use of this software and associated documentation
 * ("Software"), with or without modification, are permitted provided that the
 * following conditions are met:
 * 
 * 1. Redistributions of source code must retain copyright statements and
 * notices. Redistributions must also contain a copy of this document.
 * 
 * 2. Redistributions in binary form must reproduce the above copyright notice,
 * this list of conditions and the following disclaimer in the documentation
 * and/or other materials provided with the distribution.
 * 
 * 3. The name "DOM4J" must not be used to endorse or promote products derived
 * from this Software without prior written permission of MetaStuff, Ltd. For
 * written permission, please contact dom4j-info@metastuff.com.
 * 
 * 4. Products derived from this Software may not be called "DOM4J" nor may
 * "DOM4J" appear in their names without prior written permission of MetaStuff,
 * Ltd. DOM4J is a registered trademark of MetaStuff, Ltd.
 * 
 * 5. Due credit should be given to the DOM4J Project - http://www.dom4j.org
 * 
 * THIS SOFTWARE IS PROVIDED BY METASTUFF, LTD. AND CONTRIBUTORS ``AS IS'' AND
 * ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL METASTUFF, LTD. OR ITS CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 * POSSIBILITY OF SUCH DAMAGE.
 * 
 * Copyright 2001-2005 (C) MetaStuff, Ltd. All Rights Reserved.
 */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -