Please, could somebody help me with this issue?
Or, could somebody point me to a comprehensive StAX tutorial?
thanks!
I have prepared a simple sample that looks like 'homework', but this newbie task is getting me crazy...
I just want to store in the object
Shop[] shopsArray; the next XML file, using StAX:
<?xml version="1.0" encoding="ISO-8859-1"?>
<shops>
<shop>
<name>Amazon</name>
<code>AMZ</code>
<url>www.amazon.com</url>
<product>
<book>
<name>Core JSF</name>
<code>cojsf</code>
<price>136</price>
<pages>333</pages>
</book>
</product>
<product>
<book>
<name>Java forr Dummies</name>
<code>jfd</code>
<price>68</price>
<pages>400</pages>
</book>
</product>
<product>
<video>
<name>Braveheart</name>
<code>brvh</code>
<price>15</price>
<duration>3h</duration>
</video>
</product>
</shop>
<!-- <shop>Other types of shops</shop> -->
</shops>
Having the related classes below:
public class Shop {
String name;
String code;
String url;
Product[] productsArray;
}
public class Product {
String name;
String code;
String price;
}
public class Book extends Product {
String pages;
}
public class Video extends Product {
String duration;
}