DOM menyajikan dokumen sebagai hierarki objek node.
Tipe Node
Tabel berikut mencantumkan jenis node W3C yang berbeda dan jenis node mana yang mungkin mereka miliki sebagai turunan:
| Tipe Node | Deskripsi | Turunan |
|---|---|---|
| Document | Mewakili seluruh dokumen (root-node dari pohon DOM) | Element (max. one), ProcessingInstruction, Comment, DocumentType |
| DocumentFragment | Merepresentasikan objek Dokumen “lightweight”, yang dapat menampung sebagian dokumen | Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference |
| DocumentType | Menyediakan interface ke entitas yang ditentukan untuk dokumen | None |
| ProcessingInstruction | Merupakan instruksi pemrosesan | None |
| EntityReference | Merupakan referensi entitas | Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference |
| Element | Merupakan elemen | Element, Text, Comment, ProcessingInstruction, CDATASection, EntityReference |
| Attr | Merepresentasikan atribut | Text, EntityReference |
| Text | Merepresentasikan konten tekstual dalam elemen atau atribut | None |
| CDATASection | Merepresentasikan bagian CDATA dalam dokumen (teks yang TIDAK akan diurai oleh parser) | None |
| Comment | Merupakan sebuah komentar | None |
| Entity | Merupakan entitas | Element, ProcessingInstruction, Comment, Text, CDATASection, EntityReference |
| Notation | Merupakan notasi yang dideklarasikan di DTD | None |
Tipe Node – Nilai Pengembalian
Tabel berikut mencantumkan apa yang akan dikembalikan nodeName dan properti nodeValue untuk setiap jenis node:
| Tipe Node | nodeName returns | nodeValue returns |
|---|---|---|
| Document | #document | null |
| DocumentFragment | #document fragment | null |
| DocumentType | doctype name | null |
| EntityReference | entity reference name | null |
| Element | element name | null |
| Attr | attribute name | attribute value |
| ProcessingInstruction | target | content of node |
| Comment | #comment | comment text |
| Text | #text | content of node |
| CDATASection | #cdata-section | content of node |
| Entity | entity name | null |
| Notation | notation name | null |
Tipe Node – Nama Konstan
| Tipe Node | Nama Konstan |
|---|---|
| 1 | ELEMENT_NODE |
| 2 | ATTRIBUTE_NODE |
| 3 | TEXT_NODE |
| 4 | CDATA_SECTION_NODE |
| 5 | ENTITY_REFERENCE_NODE |
| 6 | ENTITY_NODE |
| 7 | PROCESSING_INSTRUCTION_NODE |
| 8 | COMMENT_NODE |
| 9 | DOCUMENT_NODE |
| 10 | DOCUMENT_TYPE_NODE |
| 11 | DOCUMENT_FRAGMENT_NODE |
| 12 | NOTATION_NODE |