|
|
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 4 of 7
The void reset() method, to be used after process(), resets the processor to its original state.
The process() method is overloaded 18 times. Each signature provides a different way to process your XML and XSL. Some return an org.w3c.dom.Document object. I have found that the above process() method is the handiest; the documentation recommends its use because of the XSLTInputSource (used to read in XML or XSL) and XSLTResultTarget (used to write out the results) classes, which we examine next in turn.
The XSLInputSource class can be created by using any of the following constructors:
XSLTInputSource(): Zero-argument default constructor
XSLTInputSource(org.xml.sax.InputSource isource): Creates a new XSLTInputSource source from a SAX input source
XSLTInputSource(java.io.InputStream byteStream): Creates a new input source with a byte stream
XSLTInputSource(org.w3c.dom.Node node): Creates a new input source with a DOM node
XSLTInputSource(java.io.Reader characterStream): Creates a new input source with a character stream
XSLTInputSource(java.lang.String systemId): Creates a new input source with a system identifier
The XSLResultTarget class can be created by using any of the following constructors:
XSLTResultTarget(): Zero-argument default constructor
XSLTResultTarget(org.xml.sax.DocumentHandler handler): Creates a new output target with a SAX Document handler, which will handle result events
XSLTResultTarget(org.w3c.dom.Node n): Creates a new output target with a character stream
XSLTResultTarget(java.io.OutputStream byteStream): Creates a new output target with a byte stream
XSLTResultTarget(java.lang.String fileName): Creates a new output target with a file name
XSLTResultTarget(java.io.Writer characterStream): Creates a new output target with a character stream
The API also includes classes that enable you to listen for events -- problems or document events, for example -- during processing.
Now that we have a basic overview of the XSL API and XSL stylesheets, let's look at a problem that those technologies could help us solve.
In this example, we've got a server-side process that uses XML to store transaction data. There is a business need for the ability to analyze the day's transactions. The solution should be as unobtrusive as possible, leaving the company's current process and data storage procedures unchanged.
Here are some of the possible solutions using XSL:
We'll use approach three, but the first and second approaches are both valid. Approach one would solve any performance problems, but it doesn't provide the dynamic HTML creation that will make our application special. Approach two will be a real possibility soon -- Internet Explorer 5 can do XSL translations, and Netscape has announced that its next release will, too. However, your users won't all have the newest browsers, and we still have to do server-side processing to pull the XML data.