TransformerFactory

 

 

 

 

creates

 

 

 

 

 

Templates

 

 

 

 

(stylesheet)

 

 

 

input

invokes

 

 

 

 

Transformation

output

 

 

Source

 

Result

 

 

 

 

 

 

source specification

 

result specification

DOM

SAX

 

SAX

Stream

 

Result

Source

 

Result

 

 

Source

 

 

 

 

 

 

Stream

 

 

DOM

 

Result

 

 

 

 

 

 

Source

 

 

 

Figure 3-2 javax.xml.transforms interfaces operation

3.3 SAX2

SAX is the Simple API for XML, originally a Java-only API. SAX was the first wisely adopted API for XML in Java. SAX APIs are event-based APIs, which report parsing events (such as start and end elements) directly to the application through callbacks, and does not usually build an internal tree. These event-driven APIs are used for accessing XML documents and extracting information from them. They cannot be used to manipulate the internal structures of XML documents. As the XML document is parsed, the application using SAX receives information about the various parsing events. The application implements handlers to deal with these different events, much like handling events in a graphical user interface. The logical structure of an application using SAX API with the parser is shown in Figure 3-3. You can parse documents much larger than your available system memory, and you can construct your own data structures using your callback event handlers.

58 The XML Files: Development of XML/XSL Applications Using WebSphere Studio

Page 74
Image 74
IBM Version 5 manual SAX2, Javax.xml.transforms interfaces operation