JAXP DOM Reference: Difference between revisions
Jump to navigation
Jump to search
(→Node) |
|||
Line 16: | Line 16: | ||
==Node Types== | ==Node Types== | ||
A node type can be obtained with <tt>getNodeType()</tt> call, and it is one of the following: | |||
===ELEMENT_NODE=== | |||
===ATTRIBUTE_NODE=== | |||
===TEXT_NODE=== | |||
===CDATA_SECTION_NODE=== | |||
===COMMENT_NODE=== | |||
===DOCUMENT_FRAGMENT_NODE=== | |||
===DOCUMENT_NODE=== | |||
===DOCUMENT_TYPE_NODE=== | |||
===ENTITY_NODE=== | |||
===ENTITY_REFERENCE_NODE=== | |||
===NOTATION_NODE=== | |||
===PROCESSING_INSTRUCTION_NODE=== | |||
==Node's Text Content== | ==Node's Text Content== | ||
To get the text a node contains, you need to look through the list of child nodes, ignoring entries that are of no concern and accumulating the text you find in TEXT nodes, CDATA nodes, and EntityRef nodes. | To get the text a node contains, you need to look through the list of child nodes, ignoring entries that are of no concern and accumulating the text you find in TEXT nodes, CDATA nodes, and EntityRef nodes. |
Revision as of 02:55, 11 November 2016
Internal
Overview
For an example of how to walk a DOM tree, see:
Document
Node
Node Types
A node type can be obtained with getNodeType() call, and it is one of the following:
ELEMENT_NODE
ATTRIBUTE_NODE
TEXT_NODE
CDATA_SECTION_NODE
COMMENT_NODE
DOCUMENT_FRAGMENT_NODE
DOCUMENT_NODE
DOCUMENT_TYPE_NODE
ENTITY_NODE
ENTITY_REFERENCE_NODE
NOTATION_NODE
PROCESSING_INSTRUCTION_NODE
Node's Text Content
To get the text a node contains, you need to look through the list of child nodes, ignoring entries that are of no concern and accumulating the text you find in TEXT nodes, CDATA nodes, and EntityRef nodes.