Note that there are some explanatory texts on larger screens.

plurals
  1. POios xml parsing logic
    text
    copied!<p>Can somebody help me write the parsing logic for the following xml:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8" ?&gt; &lt;countryArray&gt; &lt;bikeTypeArray&gt; &lt;dict&gt; &lt;BikeType type="3"&gt;Mountain&lt;/BikeType&gt; &lt;Country type="3"&gt;German&lt;/Country&gt; &lt;UnitSold type="2"&gt;1271&lt;/UnitSold&gt; &lt;/dict&gt; &lt;dict&gt; &lt;BikeType type="3"&gt;Road&lt;/BikeType&gt; &lt;Country type="3"&gt;German&lt;/Country&gt; &lt;UnitSold type="2"&gt;2271&lt;/UnitSold&gt; &lt;/dict&gt; &lt;dict&gt; &lt;BikeType type="3"&gt;Touring&lt;/BikeType&gt; &lt;Country type="3"&gt;German&lt;/Country&gt; &lt;UnitSold type="2"&gt;3271&lt;/UnitSold&gt; &lt;/dict&gt; &lt;dict&gt; &lt;BikeType type="3"&gt;Racing&lt;/BikeType&gt; &lt;Country type="3"&gt;German&lt;/Country&gt; &lt;UnitSold type="2"&gt;4271&lt;/UnitSold&gt; &lt;/dict&gt; &lt;/bikeTypeArray&gt; &lt;bikeTypeArray&gt; &lt;dict&gt; &lt;BikeType type="3"&gt;Mountain&lt;/BikeType&gt; &lt;Country type="3"&gt;France&lt;/Country&gt; &lt;UnitSold type="2"&gt;271&lt;/UnitSold&gt; &lt;/dict&gt; &lt;dict&gt; &lt;BikeType type="3"&gt;Road&lt;/BikeType&gt; &lt;Country type="3"&gt;France&lt;/Country&gt; &lt;UnitSold type="2"&gt;371&lt;/UnitSold&gt; &lt;/dict&gt; &lt;dict&gt; &lt;BikeType type="3"&gt;Touring&lt;/BikeType&gt; &lt;Country type="3"&gt;France&lt;/Country&gt; &lt;UnitSold type="2"&gt;471&lt;/UnitSold&gt; &lt;/dict&gt; &lt;dict&gt; &lt;BikeType type="3"&gt;Racing&lt;/BikeType&gt; &lt;Country type="3"&gt;France&lt;/Country&gt; &lt;UnitSold type="2"&gt;571&lt;/UnitSold&gt; &lt;/dict&gt; &lt;/bikeTypeArray&gt; &lt;/countryArray&gt; After parsing i need the result to be in the form of a single array as shown : po countryArray &lt;__NSArrayM 0x82299d0&gt;( &lt;__NSArrayM 0x822abf0&gt;( { BikeType = Mountain; Country = German; UnitSold = 4080; }, { BikeType = Road; Country = German; UnitSold = 20017; }, { BikeType = Touring; Country = German; UnitSold = 2035; }, { BikeType = Racing; Country = German; UnitSold = 3703; } ) , &lt;__NSArrayM 0x822ac50&gt;( { BikeType = Mountain; Country = France; UnitSold = 2195; }, { BikeType = Road; Country = France; UnitSold = 20191; }, { BikeType = Touring; Country = France; UnitSold = 4138; }, { BikeType = Racing; Country = France; UnitSold = 8378; } ) ) </code></pre> <p>So any hints on parsing please?I need a bikeType array inside a country array. dict should be in the form of key value pairs within each bikeType array.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload