XML and Dom node nodetype

Source: Internet
Author: User

Both XML and Dom have nodes, and each node has the nodetype attribute.


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

When processing XML, it processes unknown nodes. For example, when traversing, it usually needs to judge nodetype for processing.

The same is true for DOM nodes. In cross-browser development, the safest way is to process Nodes Based on nodetype. For example, ie ignores spaces between two nodes, while Firefox regards them as a node. If nodetype is used for judgment and processing, no two copies will be written.Code.

 

 

 

PS: Reference http://www.w3schools.com/Dom/dom_nodetype.asp

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.