nodeType 屬性返回選定節(jié)點(diǎn)的節(jié)點(diǎn)類型。
節(jié)點(diǎn)數(shù)量: | 節(jié)點(diǎn)名稱: |
---|---|
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 |
下面的代碼片段使用 loadXMLDoc() 把 "books.xml" 載入 xmlDoc 中,并從第一個(gè) <title> 元素取得節(jié)點(diǎn)類型:
上面的代碼將輸出:
nodeType - 忽略空的文本節(jié)點(diǎn)