nodeType 屬性返回選定節(jié)點的節(jié)點類型。
節(jié)點數量: | 節(jié)點名稱: |
---|---|
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 中,并從第一個 <title> 元素取得節(jié)點類型:
上面的代碼將輸出:
更多建議: