mkwan 2003/06/24 09:25:51
Modified: java/xdocs/sources/xsltc xsltc_trax_api.xml
Log:
Update documentation about how to use XSLTCSource.
Revision Changes Path
1.5 +10 -26 xml-xalan/java/xdocs/sources/xsltc/xsltc_trax_api.xml
Index: xsltc_trax_api.xml
===================================================================
RCS file: /home/cvs/xml-xalan/java/xdocs/sources/xsltc/xsltc_trax_api.xml,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- xsltc_trax_api.xml 27 Jan 2003 18:45:37 -0000 1.4
+++ xsltc_trax_api.xml 24 Jun 2003 16:25:51 -0000 1.5
@@ -76,36 +76,20 @@
extension to the <code>Source</code> class:</p><source>
org.apache.xalan.xsltc.trax.XSLTCSource</source>
- <p>This extension class can be used to build and encapsulate XSLTC's
internal
- DOM and DTD handler:</p><source>
+ <p>This extension class can be used to build XSLTC's internal
+ DOM and cache it for later usage. The following sample shows how to
+ use it with a <code>Transformer:</code></p><source>
public void run(String xmlfile, String xslfile) {
- // Set up your factory classes
- SAXParserFactory factory = SAXParserFactory.newInstance();
- TransformerFactory factory = TransformerFactory.newInstance();
+ // Create an XSLTCSource for the input XML document
+ XSLTCSource source = new XSLTCSource(xmlfile);
- try {
- // Create a namespace-aware parser
- try {
- factory.setFeature(Constants.NAMESPACE_FEATURE,true);
- }
- catch (Exception e) {
- factory.setNamespaceAware(true);
- }
- final SAXParser parser = factory.newSAXParser();
- final XMLReader reader = parser.getXMLReader();
+ // Build a StreamSource for the stylesheet
+ StreamSource stylesheet = new StreamSource(xslfile);
- // Build an XSLTCSource for the input XML document
- XSLTCSource source = new XSLTCSource();
- source.build(reader, xmlfile);
-
- // Build a StreamSource for the stylesheet
- StreamSource stylesheet = new StreamSource(xslfile);
-
- // Create a Transformer instance and process the input
- Transformer transformer = factory.newTransformer(stylesheet);
- transformer.transform(source, new StreamResult(System.out));
- }
+ // Create a Transformer instance and process the input
+ Transformer transformer = factory.newTransformer(stylesheet);
+ transformer.transform(source, new StreamResult(System.out));
:
:
}</source>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]