background image

Building and Running the Writer Example

<< Creating a Stream Writer | Further Information about StAX >>
<< Creating a Stream Writer | Further Information about StAX >>

Building and Running the Writer Example

</html:p>
</html:body>
</html:html>
In the actual dist/CursorWriter-Output file, this stream is written without any line breaks; the
breaks have been added here to make the listing easier to read. In this example, as with the
object stream in the Event example, the namespace prefix is added to both the opening and
closing HTML tags. Adding this prefix is not required by the StAX specification, but it is good
practice when the final scope of the output stream is not definitively known.
Building and Running the Writer Example Using NetBeans IDE
Follow these instructions to build and run the Writer example on your Application Server
instance using the NetBeans IDE.
1. In NetBeans IDE, select File
Open Project.
2. In the Open Project dialog navigate to the tut-install/javaeetutorial5/examples/stax/
directory.
3. Select the writer folder.
4. Select the Open as Main Project check box.
5. Click Open Project Folder.
6. In the Projects tab, right-click the writer project and select Properties. The Project
Properties dialog is displayed.
7. Enter the following in the Arguments field:
-f dist/CursorWriter-Output
8. Click OK.
9. Right-click the writer project and select Run Project.
Building and Running the Writer Example Using Ant
To compile and run the Writer example using Ant, in a terminal window, go to the
tut-install/javaeetutorial5/examples/stax/writer/ directory and type the following:
ant run-writer
Example Code
The Java EE 5 Tutorial · September 2007
582