DOM specification and implementation in Java (2)

zhaozj2021-02-17  53

Basic interface interface definition (Java API Package: Org.W3c.DOM):

Class inheritance (arrow pointing to the parent class, the other end is a subclass)

1.Node interface

The Node interface has a lightweight position throughout the DOM tree. A large part of the interface in the DOM interface is inherited from the Node interface, for example, Element, Attr, CDASECTION, etc., is inherited from Node. In the DOM tree, the Node interface represents a node in the tree.

Field Summary

Static short

Attribute_node the node is an attr.

Static short

CDATA_SECTION_NODE The Node Is A CDASECTION.

Static short

Comment_node the node is a comment.

Static short

Document_fragment_node the node is a documentfragment.

Static short

Document_node the node is a document.

Static short

Document_type_node the node is a documenttype.

Static short

Element_node the node is an element.

Static short

Entity_node the node is an entity.

Static short

Entity_reference_node the node is an entryreference.

Static short

NOTATION_NODE The Node is a notation.

Static short

Processing_instruction_node the node is a processinginstruction.

Static short

Text_node the node is a text node.

Method Summary

Node

Appendchild (Node NewChild) Adds the node object to the end of the child's node list of this node

Node

Clonenode (Boolean Deep) creates a new node object, he is the clone of this node, if deep = true, he will contain all the children and grandchildren nodes in this node.

NamedNodeMap

GetAttributes () If it is a node, return a nameDNodeMap object containing all properties, otherwise it is empty.

NodeList

getChildNodes () Returns Nodelist objects that contain all child nodes

Node

getFirstchild () get the first child node

Node

getLastchild () get the last child node

Java.lang.string

GetLocalName () Returns local part of the legal name of this node

Java.lang.string

GetNameSpaceuri () Returns the URI named space of this node, and returns NULL if not specified

Node

Getnextsibling () get the next brothers node of this node

Java.lang.string

GetNodeName () get the name of this node

Short

GetNodeType () get a node type

Java.lang.string

getNodeValue () get a node value

DocumentGetownerDocument () Returns the Document object to which this node belongs

Node

getParentNode () get the parent node

Java.lang.string

getPREFIX () Returns the namespace prefix of this node if you do not specify back null

Node

getPrevioussibling () gets the last brothers node of this node

Boolean

Hasattributes () Returns if there is properties

Boolean

HaschildNodes () Returns any child nodes in this node

Node

Insertbefore (Node Newchild, Node Refchild) Insert a new node NewChild before reference node Refchild

Boolean

Issupported (java.lang.string feature, java.lang.string version) Tests whether the Version version of the DOM specification supports Feature feature

Void

normalize () Puts all Text nodes in the full depth of the sub-tree underneath this Node, including attribute nodes, into a "normal" form where only structure (eg, elements, comments, processing instructions, CDATA sections, and entity references) Separates Text Nodes, IE, There Are Neither Adjacent Text Nodes Nor Empty Text Nodes.

Node

RemoveChild (Node Oldchild) Remove nodes from child node columns

Node

Replacechild (Node NewChild, Node Oldchil) Replaces the Oldchild Node for NewChild

Void

SetNodeValue (Java.lang.String NodeValue)

Void

SetPrefix (java.lang.string prefix)

转载请注明原文地址:https://www.9cbs.com/read-29561.html

New Post(0)