Attributes Entitites   «Prev  Next»

SAX model - Exercise

On your own: using the XML4J parser

Objective Use the XML4J parser to parse an XML document.

Scoring

This exercise is not scored. It's an opportunity for you to practice using the XML4J parser. When you're finished, click the OK, I'm Done button.

Download files

For this exercise, see the instructions for downloading and using the XML4J parser in the xml4j.txt file in the Resources area.
Instructions for downloading and using the XML4J parser will be included in the Resource page?

Instructions

Use the XML4J parser to parse the following XML document to return the contents of the <QUANTITY-ON-HAND> element.
<?xml version="1.0"?>
<INVENTORY location="San Francisco">
<INVENTORY-ITEM>
 <NAME>printed circuit board</NAME>
 <QUANTITY-ON-HAND>50</QUANTITY-ON-HAND>
  <VENDOR>ABC electronics</VENDOR>
 </INVENTORY-ITEM>
</INVENTORY>