Question:
The generated XML file from an .XSD template produces the output pasted below. Since category
's keys are image
, my standard way of parsing the image
items wont work on category
. I would like to place the category name="Category #"
into an array, How can I make an array from the category fields.
What I need:
What I want is an array of dictionaries. Each position contains a dictionary representing one category, and each dictionary contains images for that category.
Array: @"Category 1",@"Category 2",@"Category 3";
For each Array, a Dictionary with: <image>
and everything in between</image>
Basically, I need to create a plist like the following image, from the XML data source
XML Output:
<?xml version="1.0" encoding="UTF-8"?>
<app xmlns="http://www.wrightscs.com/_xml_.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.wrightscs.com/_xml_.xsd" name="Testing" unlock_product_id="com.wrightscs.all">
<bannerImg>http://www.wrightscs.com</bannerImg>
<category name="Category 1" icon="http://www.wrightscs.com">
<image>
<title>title</title>
<thumbUrl>http://www.wrightscs.com</thumbUrl>
<sampleUrl>http://www.wrightscs.com</sampleUrl>
<imageUrl>http://www.wrightscs.com</imageUrl>
<description>These items / keys not an issue.</description>
<infoUrl>http://www.wrightscs.com</infoUrl>
<license>http://www.wrightscs.com</license>
<licenseUrl>http://www.wrightscs.com</licenseUrl>
</image>
</category>
<category name="Category 2" icon="http://www.wrightscs.com">
<image>
<title>title</title>
<thumbUrl>http://www.wrightscs.com</thumbUrl>
<sampleUrl>http://www.wrightscs.com</sampleUrl>
<imageUrl>http://www.wrightscs.com</imageUrl>
<description>These items / keys not an issue.</description>
<infoUrl>http://www.wrightscs.com</infoUrl>
<license>http://www.wrightscs.com</license>
<licenseUrl>http://www.wrightscs.com</licenseUrl>
</image>
</category>
<category name="Category 3" icon="http://www.wrightscs.com">
<image>
<title>title</title>
<thumbUrl>http://www.wrightscs.com</thumbUrl>
<sampleUrl>http://www.wrightscs.com</sampleUrl>
<imageUrl>http://www.wrightscs.com</imageUrl>
<description>These items / keys not an issue.</description>
<infoUrl>http://www.wrightscs.com</infoUrl>
<license>http://www.wrightscs.com</license>
<licenseUrl>http://www.wrightscs.com</licenseUrl>
</image>
</category>
</app>
Note: none of the other items / keys are an issue, I am only interested in making category into an array. The URL's in this example are also replaced from the original content.