background image

Reporting CDATA Events

<< Using XMLEventWriter | SJSXP Factories Implementation >>
<< Using XMLEventWriter | SJSXP Factories Implementation >>
S
UN
'
S
S
TREAMING
P
ARSER
I
MPLEMENTATION
97
Sun's Streaming Parser Implementation
The Sun Java System Application Server (SJSAS) PE 9.0 package includes Sun
Microsystem's JSR 173 (StAX) implementation, called the Sun Java Streaming
XML Parser (SJSXP). The SJSXP is a high-speed, non-validating, W3C XML
1.0 and Namespace 1.0-compliant streaming XML pull parser built upon the
Xerces2 codebase.
In Sun's SJSXP implementation, the Xerces2 lower layers, particularly the Scan-
ner and related classes, have been redesigned to behave in a pull fashion. In addi-
tion to the changes the lower layers, the SJSXP includes additional StAX-related
functionality and many performance-enhancing improvements. The SJSXP is
implemented in
appserv-ws.jar
and
javaee.jar
, both of which are located in
the
<javaee.home>/lib
directory.
Included with this J2EE tutorial are StAX code samples, located in the
<jav-
aee.tutorial.home>/examples/stax
directory, that illustrate how Sun's
SJSXP implementation works. These samples are described in the Sample Code
section, later in this chapter.
Before proceeding with the sample code, there are two important aspects of the
SJSXP about which you should be aware:
· Reporting CDATA Events
· SJSXP Factories Implementation
These two topics are discussed below.
Reporting CDATA Events
The
javax.xml.stream.XMLStreamReader
implemented in the SJSXP does not
report CDATA events. If you have an application that needs to receive such
events, configure the
XMLInputFactory
to set the following implementation-
specific "report-cdata-event" property:
XMLInputFactory factory = XMLInptuFactory.newInstance();
factory.setProperty("report-cdata-event", Boolean.TRUE);