您的位置:首页 > Web前端 > HTML

HTML基础知识 - XML文档解析

2013-03-01 11:08 411 查看


Node Types

The following table lists the different W3C node types, and which node types they may have as children:
Node typeDescriptionChildren
DocumentRepresents the entire document (the root-node of the DOM tree)Element (max. one), ProcessingInstruction, Comment, DocumentType
DocumentFragmentRepresents a "lightweight" Document object, which can hold a portion of a documentElement, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
DocumentTypeProvides an interface to the entities defined for the documentNone
ProcessingInstructionRepresents a processing instructionNone
EntityReferenceRepresents an entity referenceElement, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
ElementRepresents an elementElement, Text, Comment, ProcessingInstruction, CDATASection, EntityReference
AttrRepresents an attributeText, EntityReference
TextRepresents textual content in an element or attributeNone
CDATASectionRepresents a CDATA section in a document (text that will NOT be parsed by a parser)None
CommentRepresents a commentNone
EntityRepresents an entityElement, ProcessingInstruction, Comment, Text, CDATASection, EntityReference
NotationRepresents a notation declared in the DTDNone


Node Types - Return Values

The following table lists what the nodeName and the nodeValue properties will return for each node type:
Node typenodeName returnsnodeValue returns
Document#documentnull
DocumentFragment#document fragmentnull
DocumentTypedoctype namenull
EntityReferenceentity reference namenull
Elementelement namenull
Attrattribute nameattribute value
ProcessingInstructiontargetcontent of node
Comment#commentcomment text
Text#textcontent of node
CDATASection#cdata-sectioncontent of node
Entityentity namenull
Notationnotation namenull


NodeTypes - Named Constants

NodeTypeNamed Constant
1ELEMENT_NODE
2ATTRIBUTE_NODE
3TEXT_NODE
4CDATA_SECTION_NODE
5ENTITY_REFERENCE_NODE
6ENTITY_NODE
7PROCESSING_INSTRUCTION_NODE
8COMMENT_NODE
9DOCUMENT_NODE
10DOCUMENT_TYPE_NODE
11DOCUMENT_FRAGMENT_NODE
12NOTATION_NODE
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐