HTML基础知识 - XML文档解析

来源:互联网 发布:淘宝客服电话怎么收费 编辑:程序博客网 时间:2024/05/02 22:14

Node Types

The following table lists the different W3C node types, and which node types they may have as children:

Node typeDescriptionChildrenDocumentRepresents the entire document (the root-node of the DOM tree)Element (max. one), ProcessingInstruction, Comment, DocumentTypeDocumentFragmentRepresents a "lightweight" Document object, which can hold a portion of a documentElement, ProcessingInstruction, Comment, Text, CDATASection, EntityReferenceDocumentTypeProvides an interface to the entities defined for the documentNoneProcessingInstructionRepresents a processing instructionNoneEntityReferenceRepresents an entity referenceElement, ProcessingInstruction, Comment, Text, CDATASection, EntityReferenceElementRepresents an elementElement, Text, Comment, ProcessingInstruction, CDATASection, EntityReferenceAttrRepresents an attributeText, EntityReferenceTextRepresents textual content in an element or attributeNoneCDATASectionRepresents a CDATA section in a document (text that will NOT be parsed by a parser)NoneCommentRepresents a commentNoneEntityRepresents an entityElement, ProcessingInstruction, Comment, Text, CDATASection, EntityReferenceNotationRepresents 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 returnsDocument#documentnullDocumentFragment#document fragmentnullDocumentTypedoctype namenullEntityReferenceentity reference namenullElementelement namenullAttrattribute nameattribute valueProcessingInstructiontargetcontent of nodeComment#commentcomment textText#textcontent of nodeCDATASection#cdata-sectioncontent of nodeEntityentity namenullNotationnotation namenull

NodeTypes - Named Constants

NodeTypeNamed Constant1ELEMENT_NODE2ATTRIBUTE_NODE3TEXT_NODE4CDATA_SECTION_NODE5ENTITY_REFERENCE_NODE6ENTITY_NODE7PROCESSING_INSTRUCTION_NODE8COMMENT_NODE9DOCUMENT_NODE10DOCUMENT_TYPE_NODE11DOCUMENT_FRAGMENT_NODE12NOTATION_NODE
原创粉丝点击