HI,
Im relatively new to XML and was wondering how I could use DOM to produce a "per shop" report showing a list of the items available in the given shop (shop 1 first then 2), the item description, stock level and calculate a total value of the stock level from the xml code below? I want to use the shop id as an input to the program. How can I get to the shop element and from there choose the item child?


<shops>
<shop number="1">
<address>
<street>Rigby Lane</street>
<town>Houghton</town>
</address>

<items>

<item number="11">
<itemname>Black Coat</itemname>
<description>long coat</description>
<price>15.99</price>
<stocklevel>12</stocklevel>
</item>

<item number="12">
<itemname>Jumper</itemname>
<description>DKNY wool</description>
<price>40.99</price>
<stocklevel>7</stocklevel>
</item>

</items>

</shop>

<shop number="2">

<address>
<street>Polaris Road</street>
<town>High Wikem</town>
</address>

<items>
<item number="14">
<itemname>Boots</itemname>
<description>Ankle</description>
<price>35.00</price>
<stocklevel>2</stocklevel>
</item>

<item number="15">
<itemname>Tights</itemname>
<description>denier 60</description>
<price>5.49</price>
<stocklevel>19</stocklevel>
</item>

</items>
</shop>
</shops>

thank you for ur coding

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.