background image

Sample XML Document

<< Running the Samples | Stepping Through Events >>
<< Running the Samples | Stepping Through Events >>
102
S
TREAMING
API
FOR
XML
The three Ant targets defined in each of the StAX
build.xml
files are:
·
build
­ Compile and run all classes
·
run
­ Run the example
· clean ­ Clean all compiled files and sample directories when you are done
For example, to run the
cursor
example:
cd <javaee.tutorial.home>/examples/stax/cursor
asant build
asant run
Sample XML Document
The sample XML document,
BookCatalogue.xml
, used by most of the StAX
sample
classes
is
located
in
the
<javaee.tutorial.home>/exam-
ples/stax/common/data
directory, and is a simple book catalog based on the
common
BookCatalogue
namespace. The contents of
BookCatalogue.xml
are
listed below:
<?xml version="1.0" encoding="UTF-8"?>
<BookCatalogue xmlns="http://www.publishing.org">
<Book>
<Title>Yogasana Vijnana: the Science of Yoga</Title>
<author>Dhirendra Brahmachari</Author>
<Date>1966</Date>
<ISBN>81-40-34319-4</ISBN>
<Publisher>Dhirendra Yoga Publications</Publisher>
<Cost currency="INR">11.50</Cost>
</Book>
<Book>
<Title>The First and Last Freedom</Title>
<Author>J. Krishnamurti</Author>
<Date>1954</Date>
<ISBN>0-06-064831-7</ISBN>
<Publisher>Harper &amp; Row</Publisher>
<Cost currency="USD">2.95</Cost>
</Book>
</BookCatalogue>