blob: d7bbe6609e450ee768d7bce97591c834b92dc0f2 [file] [log] [blame]
<html>
<!--
* ASM XML Adapter
* Copyright (c) 2004-2011, Eugene Kuleshov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. Neither the name of the copyright holders nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
* THE POSSIBILITY OF SUCH DAMAGE.
-->
<body>
Provides <a href="http://sax.sourceforge.net/">SAX 2.0</a> adapters for ASM
visitors to convert classes to and from XML.
These adapters can be chained with other SAX compliant content handlers and
filters, eg. XSLT or XQuery engines. This package is bundled as
a separate <tt>asm-xml.jar</tt> library and requires <tt>asm.jar</tt>.
<p>
<tt>ASMContentHandler</tt> and <tt>SAXClassAdapter/SAXCodeAdapter</tt>
are using <a href="asm-xml.dtd">asm-xml.dtd</a>.
Here is the example of bytecode to bytecode XSLT transformation.
<pre>
SAXTransformerFactory saxtf = ( SAXTransformerFactory) TransformerFactory.newInstance();
Templates templates = saxtf.newTemplates( xsltSource);
TransformerHandler handler = saxtf.newTransformerHandler( templates);
handler.setResult( new SAXResult( new ASMContentHandler( outputStream, computeMax)));
ClassReader cr = new ClassReader( bytecode);
cr.accept( new SAXClassAdapter( handler, cr.getVersion(), false), false);
</pre>
See JAXP and SAX documentation for more detils.
<p>
There are few illustrations of the bytecode transformation with XSLT in
examples directory. The following XSLT procesors has been tested.
<blockquote>
<table border="1" cellspacing="0" cellpadding="3">
<tr>
<th>Engine</td>
<th>javax.xml.transform.TransformerFactory property</td>
</tr>
<tr>
<td>jd.xslt</td>
<td>jd.xml.xslt.trax.TransformerFactoryImpl</td>
</tr>
<tr>
<td>Saxon</td>
<td>net.sf.saxon.TransformerFactoryImpl</td>
</tr>
<tr>
<td>Caucho</td>
<td>com.caucho.xsl.Xsl</td>
</tr>
<tr>
<td>Xalan interpeter</td>
<td>org.apache.xalan.processor.TransformerFactory</td>
</tr>
<tr>
<td>Xalan xsltc</td>
<td>org.apache.xalan.xsltc.trax.TransformerFactoryImpl</td>
</tr>
</table>
</blockquote>
@since ASM 1.4.3
</body>
</html>