nodeimpl.java

来自「JAVA 所有包」· Java 代码 · 共 1,687 行 · 第 1/5 页

JAVA
1,687
字号
    protected int getNodeNumber() {        int nodeNumber;        CoreDocumentImpl cd = (CoreDocumentImpl)(this.getOwnerDocument());        nodeNumber = cd.getNodeNumber(this);           return nodeNumber;    }    /**     * Obtain the DOM-tree parent of this node, or null if it is not     * currently active in the DOM tree (perhaps because it has just been     * created or removed). Note that Document, DocumentFragment, and     * Attribute will never have parents.     */    public Node getParentNode() {        return null;            // overriden by ChildNode    }    /*     * same as above but returns internal type     */    NodeImpl parentNode() {        return null;    }    /** The next child of this node's parent, or null if none */    public Node getNextSibling() {        return null;            // default behavior, overriden in ChildNode    }    /** The previous child of this node's parent, or null if none */    public Node getPreviousSibling() {        return null;            // default behavior, overriden in ChildNode    }    ChildNode previousSibling() {        return null;            // default behavior, overriden in ChildNode    }    /**     * Return the collection of attributes associated with this node,     * or null if none. At this writing, Element is the only type of node     * which will ever have attributes.     *     * @see ElementImpl     */    public NamedNodeMap getAttributes() {    	return null; // overridden in ElementImpl    }    /**     *  Returns whether this node (if it is an element) has any attributes.     * @return <code>true</code> if this node has any attributes,      *   <code>false</code> otherwise.     * @since DOM Level 2     * @see ElementImpl     */    public boolean hasAttributes() {        return false;           // overridden in ElementImpl    }    /**     * Test whether this node has any children. Convenience shorthand     * for (Node.getFirstChild()!=null)     * <P>     * By default we do not have any children, ParentNode overrides this.     * @see ParentNode     */    public boolean hasChildNodes() {        return false;    }    /**     * Obtain a NodeList enumerating all children of this node. If there     * are none, an (initially) empty NodeList is returned.     * <p>     * NodeLists are "live"; as children are added/removed the NodeList     * will immediately reflect those changes. Also, the NodeList refers     * to the actual nodes, so changes to those nodes made via the DOM tree     * will be reflected in the NodeList and vice versa.     * <p>     * In this implementation, Nodes implement the NodeList interface and     * provide their own getChildNodes() support. Other DOMs may solve this     * differently.     */    public NodeList getChildNodes() {        return this;    }    /** The first child of this Node, or null if none.     * <P>     * By default we do not have any children, ParentNode overrides this.     * @see ParentNode     */    public Node getFirstChild() {    	return null;    }    /** The first child of this Node, or null if none.     * <P>     * By default we do not have any children, ParentNode overrides this.     * @see ParentNode     */    public Node getLastChild() {	return null;    }    /**     * Move one or more node(s) to our list of children. Note that this     * implicitly removes them from their previous parent.     * <P>     * By default we do not accept any children, ParentNode overrides this.     * @see ParentNode     *     * @param newChild The Node to be moved to our subtree. As a     * convenience feature, inserting a DocumentNode will instead insert     * all its children.     *     * @param refChild Current child which newChild should be placed     * immediately before. If refChild is null, the insertion occurs     * after all existing Nodes, like appendChild().     *     * @return newChild, in its new state (relocated, or emptied in the case of     * DocumentNode.)     *     * @throws DOMException(HIERARCHY_REQUEST_ERR) if newChild is of a     * type that shouldn't be a child of this node, or if newChild is an     * ancestor of this node.     *     * @throws DOMException(WRONG_DOCUMENT_ERR) if newChild has a     * different owner document than we do.     *     * @throws DOMException(NOT_FOUND_ERR) if refChild is not a child of     * this node.     *     * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if this node is     * read-only.     */    public Node insertBefore(Node newChild, Node refChild) 	throws DOMException {	throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,               DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,                 "HIERARCHY_REQUEST_ERR", null));    }    /**     * Remove a child from this Node. The removed child's subtree     * remains intact so it may be re-inserted elsewhere.     * <P>     * By default we do not have any children, ParentNode overrides this.     * @see ParentNode     *     * @return oldChild, in its new state (removed).     *     * @throws DOMException(NOT_FOUND_ERR) if oldChild is not a child of     * this node.     *     * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if this node is     * read-only.     */    public Node removeChild(Node oldChild) 		throws DOMException {	throw new DOMException(DOMException.NOT_FOUND_ERR,               DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,                 "NOT_FOUND_ERR", null));    }    /**     * Make newChild occupy the location that oldChild used to     * have. Note that newChild will first be removed from its previous     * parent, if any. Equivalent to inserting newChild before oldChild,     * then removing oldChild.     * <P>     * By default we do not have any children, ParentNode overrides this.     * @see ParentNode     *     * @return oldChild, in its new state (removed).     *     * @throws DOMException(HIERARCHY_REQUEST_ERR) if newChild is of a     * type that shouldn't be a child of this node, or if newChild is     * one of our ancestors.     *     * @throws DOMException(WRONG_DOCUMENT_ERR) if newChild has a     * different owner document than we do.     *     * @throws DOMException(NOT_FOUND_ERR) if oldChild is not a child of     * this node.     *     * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if this node is     * read-only.     */    public Node replaceChild(Node newChild, Node oldChild)        throws DOMException {	throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,               DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,                 "HIERARCHY_REQUEST_ERR", null));    }    //    // NodeList methods    //    /**     * NodeList method: Count the immediate children of this node     * <P>     * By default we do not have any children, ParentNode overrides this.     * @see ParentNode     *     * @return int     */    public int getLength() {	return 0;    }    /**     * NodeList method: Return the Nth immediate child of this node, or     * null if the index is out of bounds.     * <P>     * By default we do not have any children, ParentNode overrides this.     * @see ParentNode     *     * @return org.w3c.dom.Node     * @param Index int     */    public Node item(int index) {	return null;    }    //    // DOM2: methods, getters, setters    //    /**     * Puts all <code>Text</code> nodes in the full depth of the sub-tree      * underneath this <code>Node</code>, including attribute nodes, into a      * "normal" form where only markup (e.g., tags, comments, processing      * instructions, CDATA sections, and entity references) separates      * <code>Text</code> nodes, i.e., there are no adjacent <code>Text</code>      * nodes.  This can be used to ensure that the DOM view of a document is      * the same as if it were saved and re-loaded, and is useful when      * operations (such as XPointer lookups) that depend on a particular      * document tree structure are to be used.In cases where the document      * contains <code>CDATASections</code>, the normalize operation alone may      * not be sufficient, since XPointers do not differentiate between      * <code>Text</code> nodes and <code>CDATASection</code> nodes.     * <p>     * Note that this implementation simply calls normalize() on this Node's     * children. It is up to implementors or Node to override normalize()     * to take action.     */    public void normalize() {	/* by default we do not have any children,	   ParentNode overrides this behavior */    }    /**     * Introduced in DOM Level 2. <p>     * Tests whether the DOM implementation implements a specific feature and     * that feature is supported by this node.     * @param feature The package name of the feature to test. This is the same     * name as what can be passed to the method hasFeature on     * DOMImplementation.     * @param version This is the version number of the package name to     * test. In Level 2, version 1, this is the string "2.0". If the version is     * not specified, supporting any version of the feature will cause the     * method to return true.     * @return boolean Returns true if this node defines a subtree within which     * the specified feature is supported, false otherwise.     * @since WD-DOM-Level-2-19990923     */    public boolean isSupported(String feature, String version)    {        return ownerDocument().getImplementation().hasFeature(feature,                                                              version);    }    /**     * Introduced in DOM Level 2. <p>     *     * The namespace URI of this node, or null if it is unspecified. When this     * node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE, this is     * always null and setting it has no effect. <p>     *     * This is not a computed value that is the result of a namespace lookup     * based on an examination of the namespace declarations in scope. It is     * merely the namespace URI given at creation time.<p>     *     * For nodes created with a DOM Level 1 method, such as createElement     * from the Document interface, this is null.     * @since WD-DOM-Level-2-19990923     * @see AttrNSImpl     * @see ElementNSImpl     */    public String getNamespaceURI()    {        return null;    }    /**     * Introduced in DOM Level 2. <p>     *     * The namespace prefix of this node, or null if it is unspecified. When     * this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE this     * is always null and setting it has no effect.<p>     *     * For nodes created with a DOM Level 1 method, such as createElement     * from the Document interface, this is null. <p>     *     * @since WD-DOM-Level-2-19990923     * @see AttrNSImpl     * @see ElementNSImpl     */    public String getPrefix()    {        return null;    }    /**     *  Introduced in DOM Level 2. <p>     *     *  The namespace prefix of this node, or null if it is unspecified. When     *  this node is of any type other than ELEMENT_NODE and ATTRIBUTE_NODE     *  this is always null and setting it has no effect.<p>     *     *  For nodes created with a DOM Level 1 method, such as createElement from     *  the Document interface, this is null.<p>     *     *  Note that setting this attribute changes the nodeName attribute, which     *  holds the qualified name, as well as the tagName and name attributes of     *  the Element and Attr interfaces, when applicable.<p>     *     * @throws INVALID_CHARACTER_ERR Raised if the specified     *  prefix contains an invalid character.     *     * @since WD-DOM-Level-2-19990923     * @see AttrNSImpl     * @see ElementNSImpl     */    public void setPrefix(String prefix)

⌨️ 快捷键说明

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