Parse XML documents and XML strings using JS (ie and Firefox)

Source: Internet
Author: User

 

Parse XML documents and XML strings using Js.

 

Parse the XML document and XML string for IE and Firefox respectively. All the code has been commented out. Which of the following functions do you want to see,

Just remove the comment.

 

As for XML parsing in the Ajax environment, the principle is the same, but the XML returned must be parsed In the Ajax environment.

 

 

<! Doctype HTML public "-// W3C // dtd html 4.01 transitional // en" "http://www.w3.org/TR/html4/loose.dtd"> <HTML> 

The layer of each XML node is the most annoying problem. You can only try it again and again,

Determine the node hierarchy, or debug it.

I feel that JSON is better able to read and understand this aspect. This parsing is too hard!

 

 

The document house. XML is as follows:

<? XML version = "1.0" encoding = "UTF-8"?> <Address> <city name = "Beijing"> <price> 1.5 million </price> <type> one-bedroom, three-bedroom </type> </city> <city name = "Shanghai"> <price> 2 million </price> </city> <city name = "Hangzhou"> <price> 2.3 million </price> </city> <city name = "Nanjing"> </city> </address>

 

 

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.