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>