All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----javax.xml.transform.sax.SAXResult | +----org.jdom.transform.JDOMResult
This class shall be used to get the result of XSL Transformation as a JDOM Document.
The following example shows how to apply an XSL Transformation to a JDOM document and get the transformation result in the form of another JDOM Document:
public static Document transform(Document in, String stylesheet) throws JDOMException { try { Transformer transformer = TransformerFactory.newInstance() .newTransformer(new StreamSource(stylesheet)); JDOMResult out = new JDOMResult(); transformer.transform(new JDOMSource(in), out); return out.getDocument(); } catch (TransformerException e) { throw new JDOMException("XSLT Trandformation failed", e); } }
public static final String JDOM_FEATURE
true
when passed this value as an
argument, the Transformer natively supports JDOM.
Note: This implementation does not override the {@link SAXResult#FEATURE} value defined by its superclass to be considered as a SAXResult by Transformer implementations not natively supporting JDOM.
public JDOMResult()
public void setDocument(Document document)
Note: This method shall be used by the {@link javax.xml.transform.Transformer} implementations that natively support JDOM to directly set the transformation result rather than considering this object as a {@link SAXResult}. Applications should not use this method.
public Document getDocument()
public void setFactory(JDOMFactory factory)
JDOMFactory
to use or
null
to use the default JDOM
classes.
public JDOMFactory getFactory()
JDOMFactory
used to build the
result document or null
if the default
JDOM classes are being used.
public void setHandler(ContentHandler handler)
public void setLexicalHandler(LexicalHandler handler)
This is needed to handle XML comments and the like. If the lexical handler is not set, an attempt should be made by the transformer to cast the ContentHandler to a LexicalHandler.
All Packages Class Hierarchy This Package Previous Next Index