All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----javax.xml.transform.sax.SAXSource | +----org.jdom.transform.JDOMSource
This class shall be used to wrap a JDOM Document to provide it as input to a JAXP Transformer
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 SAXSource#FEATURE} value defined by its superclass to be considered as a SAXSource by Transformer implementations not natively supporting JDOM.
public JDOMSource(Document source)
source
is
null
.
public void setDocument(Document source)
source
is
null
.
public Document getDocument()
null
if none has been set.
public void setInputSource(InputSource inputSource) throws UnsupportedOperationException
As this implementation only supports JDOM document as data source, this method always throws an {@link UnsupportedOperationException}.
public void setXMLReader(XMLReader reader) throws UnsupportedOperationException
As this implementation only supports JDOM document as data source, this method throws an {@link UnsupportedOperationException} if the provided reader object does not implement the SAX {@link XMLFilter} interface. Otherwise, the JDOM document reader will be attached as parent of the filter chain.
public XMLReader getXMLReader()
This implementation returns a specific XMLReader reading the XML data from the source JDOM document.
All Packages Class Hierarchy This Package Previous Next Index