1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> |
---|
2 | <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml" lang="en"> |
---|
3 | <head> |
---|
4 | <script type="text/javascript" src="jquery-1.3.2.js"></script> |
---|
5 | <script type="text/javascript"> |
---|
6 | //<![CDATA[ |
---|
7 | var DataUtilities = (function() { |
---|
8 | var self = { |
---|
9 | "processXML": function(xml) { |
---|
10 | if (!jQuery.support.htmlSerialize) { |
---|
11 | //If IE 6+ |
---|
12 | var xmlDoc = new ActiveXObject("Microsoft.XMLDOM"); |
---|
13 | xmlDoc.loadXML(xml); |
---|
14 | xml = xmlDoc; |
---|
15 | } |
---|
16 | return xml; |
---|
17 | } |
---|
18 | }; |
---|
19 | return self; |
---|
20 | })(); |
---|
21 | |
---|
22 | var foo = '<forms><section id="foo1"><form></form></section><section id="foo2"><form></form></section></forms>'; |
---|
23 | var bar = '<forms><section id="bar1"></section><section id="bar2"></section></forms>'; |
---|
24 | |
---|
25 | $(document).ready(function() { |
---|
26 | foo = DataUtilities.processXML(foo); //fix for IE |
---|
27 | bar = DataUtilities.processXML(bar); //fix for IE |
---|
28 | $(foo).find("section").each(function() { |
---|
29 | $("#content").append($(this).attr("id") + "<br/>"); |
---|
30 | }); |
---|
31 | $(bar).find("section").each(function() { |
---|
32 | $("#content").append($(this).attr("id") + "<br/>"); |
---|
33 | }); |
---|
34 | }); |
---|
35 | //]]> |
---|
36 | </script> |
---|
37 | |
---|
38 | <title>Test</title> |
---|
39 | </head> |
---|
40 | |
---|
41 | <body id="content"> |
---|
42 | </body> |
---|
43 | </html> |
---|