org.apache.trax
Class Examples

java.lang.Object
  |
  +--org.apache.trax.Examples

public class Examples
extends java.lang.Object

Some examples to show how the Simple API for Transformations could be used.


Constructor Summary
Examples()
           
 
Method Summary
static void exampleDOM2DOM(java.lang.String sourceID, java.lang.String xslID)
          Show how to transform a DOM tree into another DOM tree.
static void exampleOutputFormat(java.lang.String sourceID, java.lang.String xslID)
          Show how to override output properties.
static void exampleParam(java.lang.String sourceID, java.lang.String xslID)
          This shows how to set a parameter for use by the templates.
static void exampleSAX2SAX(java.lang.String sourceID, java.lang.String xslID)
          Show the Transformer using SAX events in and SAX events out.
static void exampleSimple(java.lang.String sourceID, java.lang.String xslID)
          Show the simplest possible transformation from system id to output stream.
static void exampleUseAssociated()
          Show how to get stylesheets that are associated with a given xml document via the xml-stylesheet PI (see http://www.w3.org/TR/xml-stylesheet/).
static void exampleXMLFilter(java.lang.String sourceID, java.lang.String xslID)
          Show the Transformer as a SAX2 XMLFilter/XMLReader.
static void exampleXMLFilterChain(java.lang.String sourceID, java.lang.String xslID_1, java.lang.String xslID_2, java.lang.String xslID_3)
          This example shows how to chain events from one Transformer to another transformer, using the Transformer as a SAX2 XMLFilter/XMLReader.
static void main(java.lang.String[] argv)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Examples

public Examples()
Method Detail

main

public static void main(java.lang.String[] argv)
                 throws ProcessorException,
                        ProcessorFactoryException,
                        TransformException,
                        SAXException,
                        java.io.IOException,
                        ParserConfigurationException

exampleSimple

public static void exampleSimple(java.lang.String sourceID,
                                 java.lang.String xslID)
                          throws ProcessorException,
                                 ProcessorFactoryException,
                                 TransformException,
                                 SAXException,
                                 java.io.IOException
Show the simplest possible transformation from system id to output stream.

exampleSAX2SAX

public static void exampleSAX2SAX(java.lang.String sourceID,
                                  java.lang.String xslID)
                           throws SAXException,
                                  java.io.IOException
Show the Transformer using SAX events in and SAX events out.

exampleXMLFilter

public static void exampleXMLFilter(java.lang.String sourceID,
                                    java.lang.String xslID)
                             throws SAXException,
                                    java.io.IOException
Show the Transformer as a SAX2 XMLFilter/XMLReader. In this case the Transformer acts like a parser, and can in fact be polymorphicaly used in places where a SAX parser would be used.

exampleXMLFilterChain

public static void exampleXMLFilterChain(java.lang.String sourceID,
                                         java.lang.String xslID_1,
                                         java.lang.String xslID_2,
                                         java.lang.String xslID_3)
                                  throws SAXException,
                                         java.io.IOException
This example shows how to chain events from one Transformer to another transformer, using the Transformer as a SAX2 XMLFilter/XMLReader.

exampleDOM2DOM

public static void exampleDOM2DOM(java.lang.String sourceID,
                                  java.lang.String xslID)
                           throws SAXException,
                                  java.io.IOException,
                                  ParserConfigurationException
Show how to transform a DOM tree into another DOM tree. This uses the javax.xml.parsers to parse an XML file into a DOM, and create an output DOM.

exampleParam

public static void exampleParam(java.lang.String sourceID,
                                java.lang.String xslID)
                         throws ProcessorException,
                                ProcessorFactoryException,
                                TransformException,
                                SAXException,
                                java.io.IOException
This shows how to set a parameter for use by the templates.

exampleOutputFormat

public static void exampleOutputFormat(java.lang.String sourceID,
                                       java.lang.String xslID)
                                throws ProcessorException,
                                       ProcessorFactoryException,
                                       TransformException,
                                       SAXException,
                                       java.io.IOException
Show how to override output properties.

exampleUseAssociated

public static void exampleUseAssociated()
                                 throws ProcessorException,
                                        ProcessorFactoryException,
                                        TransformException,
                                        SAXException,
                                        java.io.IOException
Show how to get stylesheets that are associated with a given xml document via the xml-stylesheet PI (see http://www.w3.org/TR/xml-stylesheet/).


Copyright © 2000 Apache XML Project. All Rights Reserved.