The Java EE 5 Tutorial

Returning the Output

When you run the Event example, the EventParse class is compiled, and the XML stream is parsed as events and returned to STDOUT. For example, an instance of the Author element is returned as:

    Dhirendra Brahmachari

Note in this example that the event comprises an opening and closing tag, both of which include the namespace. The content of the element is returned as a string within the tags.

Similarly, an instance of the Cost element is returned as:

<[’’]::Cost currency=’INR’>

In this case, the currency attribute and value are returned in the opening tag for the event.