•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the XML, XSLT and XPATH section within the Software Development category of DaniWeb, a massive community of 402,444 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 2,968 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our XML, XSLT and XPATH advertiser: Programming Forums
Views: 3266 | Replies: 1
![]() |
•
•
Join Date: Jun 2005
Posts: 14
Reputation:
Rep Power: 4
Solved Threads: 0
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>
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>
![]() |
•
•
•
•
•
•
•
•
DaniWeb XML, XSLT and XPATH Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
•
•
•
•
api asp bebo blogger blogging code com development dom drama feed gdata google html java katemodern linspire linux lonelygirl15 microsoft microsoft sdk for java microsystems news open openoffice platform programming reader rss soap software source standards sun tv video w3c weather web xml xoap youtube
- How to read the parsed XML file (DOM parser) (Java)
- Eliminating Whitespace characters while parsing XML Files using DOM (Java)
- creating a report from XML using DOM (XML, XSLT and XPATH)
- Xml Database Connectivity in Java (Java)
- XML in Java Mobile application (Java)
Other Threads in the XML, XSLT and XPATH Forum
- Previous Thread: Historical Video Interviews with XML Co-Creator
- Next Thread: Help needed in simple app while using XML,XSL


Linear Mode