XML DOM ဂိုး အမျိုးအစား

instance

In the following example, we will use the XML file books.xmland JavaScript function loadXMLDoc().

all elements' node name and node type display
all elements' node name and node value display

လိပ်မှု့အကျိုး

အောက်ရှိ တင်ဆက်ထားသော တေးရာများအရ မျိုးဆက်များ နှင့် လိပ်မှု့အကျိုး က ပြန်အပ်သော အကျိုးများ ကို ကြည့်ရမည်။

လိပ်မှု့အကျိုး description child element
ဆိုင်းခုန်း entire document (root node of DOM tree)
  • Element (max. one)
  • ProcessingInstruction
  • Comment
  • DocumentType
ဆိုင်းခုန်းအုပ် lightweight Document object ကို ပြန်အပ်သည် ဆိုင်းခုန်းတွင် အချက်အလက်များ ပါဝင်သည်
  • ProcessingInstruction
  • Comment
  • Text
  • CDATASection
  • EntityReference
DocumentType document-defined entity အတွက် အဖွဲ့အစည်းကို ပေးခဲ့သည် None
ProcessingInstruction processing instruction None
EntityReference entity reference element
  • ProcessingInstruction
  • Comment
  • Text
  • CDATASection
  • EntityReference
Element element (အဆိုပါ အဆိုပါ အဆိုပါ)
  • Text
  • Comment
  • ProcessingInstruction
  • CDATASection
  • EntityReference
Attr အချက်အလက်
  • Text
  • EntityReference
Text အချက်အလက်များ ကို ကိုးကားသည် None
CDATASection ဆိုင်းခုန်းတွင် အကျုံးကျနေသော အချက်အလက်များ ကို ကိုးကားသည် (အသုံးပြုသူက အသုံးပြုသည်) None
Comment ဖော်ပြထားသော အသိပ်များကို ကိုးကားသည် None
Entity အမှတ်အသားကို ကိုးကားသည်
  • ProcessingInstruction
  • Comment
  • Text
  • CDATASection
  • EntityReference
Notation DTD တွင် ဖော်ပြထားသော အမှတ်အသားကို ကိုးကားသည် None

လိပ်မှု့အကျိုး - ပြန်အပ်သော အကျိုး

အောက်ရှိ တင်ဆက်ထားသော တေးရာများအရ လိပ်မှု့အကျိုး နှင့် nodeValue အကျိုး က ပြန်အပ်သော အကျိုးများ ကို ကြည့်ရမည်။

လိပ်မှု့အကျိုး nodeName က ပြန်အပ်သော အကျိုး nodeValue က ပြန်အပ်သော အကျိုး
ဆိုင်းခုန်း #ဆိုင်းခုန်း null
ဆိုင်းခုန်းအုပ် #document fragment null
DocumentType doctype Name null
EntityReference Entity Reference Name null
Element Element Name null
Attr Attribute Name Attribute Value
ProcessingInstruction target Node Content
Comment #comment Comment Text
Text #text Node Content
CDATASection #cdata-section Node Content
Entity Entity Name null
Notation အမှတ်အသား null

NodeTypes - အမှတ်အသား

NodeType Named Constant
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