The nodeType property returns node type of the selected node.
Node Number: | Node Name: |
---|---|
1 | Element |
2 | Attribute |
3 | Text |
4 | CDATA Section |
5 | Entity Reference |
6 | Entity |
7 | Processing Instruction |
8 | Comment |
9 | Document |
10 | Document Type |
11 | Document Fragment |
12 | Notation |
The following code fragment loads "books.xml" into xmlDoc using loadXMLDoc() and gets the node type from the first <title> element:
The output of the code above will be:
nodeType - Skip empty text nodes