javascript - Use JQuery to iterate over deep XML structure - IE9 -
I have a variable I am creating a JS object based on this XML. The result should be an array with questions, each question has an array of its properties and options. So basically like the same structure as you see in XML under the JS code is here to generate the object: Now the problem is that I can see that the first with jQuery How do I get a loop on many XML levels? Edit : It seems that is related to IE9, I need it working on this specific browser . data with the following XML in JS:
& lt; Data & gt; & Lt; Distribution & gt; & Lt; Checklist & gt; Pre-Vehicle Check Bulk & lt; / Checklist & gt; & Lt; Distribution & gt; 800056799 & lt; / Distribution & gt; & Lt; Shipment & gt; 105065995 & lt; / Shipment & gt; & Lt; DriverName & gt; John Doe & lt; / DriverName & gt; & Lt; DriverLanguage & gt; NL & lt; / DriverLanguage & gt; & Lt; Country & gt; Belgium & lt; / Country & gt; & Lt; Products & gt; 01248741 & lt; / Products & gt; & Lt; Product Details & gt; Metam 200% -33 & lt; / ProductDescription & gt; & Lt; Location & gt; P0204A & lt; / Location & gt; & Lt; / Distribution & gt; & Lt; Question & gt; & Lt; Question & gt; & Lt; ID & gt; Question 1 & lt; / Id & gt; & Lt; Driver & gt; True & lt; / Driver & gt; & Lt; Operator & gt; True & lt; / Operator & gt; & Lt; IsAnswered & gt; False & lt; / IsAnswered & gt; & Lt; Answer / & gt; & Lt; Options & gt; & Lt; Options & gt; OK & lt; / Options & gt; & Lt; Options & gt; NOK & lt; / Options & gt; & Lt; Options & gt; NA & lt; / Options & gt; & Lt; / Options & gt; & Lt; / Question & gt; & Lt; Question & gt; & Lt; ID & gt; Question-2 & lt; / Id & gt; & Lt; Driver & gt; True & lt; / Driver & gt; & Lt; Operator & gt; False & lt; / Operator & gt; & Lt; IsAnswered & gt; False & lt; / IsAnswered & gt; & Lt; Answer / & gt; & Lt; Options & gt; & Lt; Options & gt; OK & lt; / Options & gt; & Lt; Options & gt; NOK & lt; / Options & gt; & Lt; / Options & gt; & Lt; / Question & gt; & Lt; / Question & gt; & Lt; / Data & gt;
Question
tag
var question = []; $ (Data) .Find ("question"). Each (function () {var option = []; $ (this) .find ("option"). (Function () {options.push ($ (this) ("id"). Text (), driver: $ (This) .fund ("driver"). Text (), operator: $ (this) .Find ("operator"). Text (), has been replied: $ (this). Text (), answer: $ (this). Symbol ("answer"). Text (), title: $ (this) .find ("title"). Text (), text: $ (this ) .film ("text"). Text (), text_diver: $ (this) .find ("text_driver"). Text (), options: option});});
.each
to by
& lt; option & gt; OKNOKNA
May include'm guessing IE9 thinks these HTML option element invalid location. $
Comments
Post a Comment