public class JDOMSource
extends javax.xml.transform.sax.SAXSource
 The is provides input to a
 JAXP TrAX Transformer.
 
The following example shows how to apply an XSL Transformation to a JDOM document and get the transformation result in the form of a list of JDOM nodes:
   public static List transform(Document doc, String stylesheet)
                                        throws JDOMException {
     try {
       Transformer transformer = TransformerFactory.newInstance()
                             .newTransformer(new StreamSource(stylesheet));
       JDOMSource in = new JDOMSource(doc);
       JDOMResult out = new JDOMResult();
       transformer.transform(in, out);
       return out.getResult();
     }
     catch (TransformerException e) {
       throw new JDOMException("XSLT Transformation failed", e);
     }
   }
 JDOMResult| Modifier and Type | Field and Description | 
|---|---|
static java.lang.String | 
JDOM_FEATURE
If  
TransformerFactory.getFeature(java.lang.String)
 returns true when passed this value as an
 argument, the Transformer natively supports JDOM. | 
| Constructor and Description | 
|---|
JDOMSource(Document source)
Creates a JDOM TrAX source wrapping a JDOM document. 
 | 
JDOMSource(Document source,
          org.xml.sax.EntityResolver resolver)
Creates a JDOM TrAX source wrapping a JDOM element with an
 associated EntityResolver to resolve external entities. 
 | 
JDOMSource(Element source)
Creates a JDOM TrAX source wrapping a JDOM element. 
 | 
JDOMSource(java.util.List<? extends Content> source)
Creates a JDOM TrAX source wrapping a list of JDOM nodes. 
 | 
| Modifier and Type | Method and Description | 
|---|---|
Document | 
getDocument()
Returns the source document used by this TrAX source. 
 | 
java.util.List<? extends Content> | 
getNodes()
Returns the source node list used by this TrAX source. 
 | 
org.xml.sax.XMLReader | 
getXMLReader()
Returns the XMLReader to be used for the Source. 
 | 
void | 
setDocument(Document source)
Sets the source document used by this TrAX source. 
 | 
void | 
setInputSource(org.xml.sax.InputSource inputSource)
Sets the SAX InputSource to be used for the Source. 
 | 
void | 
setNodes(java.util.List<? extends Content> source)
Sets the source node list used by this TrAX source. 
 | 
void | 
setXMLReader(org.xml.sax.XMLReader reader)
Set the XMLReader to be used for the Source. 
 | 
public static final java.lang.String JDOM_FEATURE
TransformerFactory.getFeature(java.lang.String)
 returns true when passed this value as an
 argument, the Transformer natively supports JDOM.
 
 Note: This implementation does not override
 the 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 - the JDOM document to use as source for the
                  transformationsjava.lang.IllegalArgumentException - if source is
                                    null.public JDOMSource(java.util.List<? extends Content> source)
source - the JDOM nodes to use as source for the
                  transformationsjava.lang.IllegalArgumentException - if source is
                                    null.public JDOMSource(Element source)
source - the JDOM element to use as source for the
                  transformationsjava.lang.IllegalArgumentException - if source is
                                    null.public JDOMSource(Document source, org.xml.sax.EntityResolver resolver)
source - The JDOM Element to use as source for the 
                                        transformationsresolver - Entity resolver to use for the source 
                                        transformationjava.lang.IllegalArgumentException - ifsource is
 nullpublic void setDocument(Document source)
source - the JDOM document to use as source for the
                  transformationsjava.lang.IllegalArgumentException - if source is
                                    null.getDocument()public Document getDocument()
null if the source is a node list.setDocument(org.jdom2.Document)public void setNodes(java.util.List<? extends Content> source)
source - the JDOM nodes to use as source for the
                  transformationsjava.lang.IllegalArgumentException - if source is
                                    null.getNodes()public java.util.List<? extends Content> getNodes()
null if the source is a JDOM document.setDocument(org.jdom2.Document)public void setInputSource(org.xml.sax.InputSource inputSource)
                    throws java.lang.UnsupportedOperationException
 As this implementation only supports JDOM document as data
 source, this method always throws an
 UnsupportedOperationException.
 
setInputSource in class javax.xml.transform.sax.SAXSourceinputSource - a valid InputSource reference.java.lang.UnsupportedOperationException - always!public void setXMLReader(org.xml.sax.XMLReader reader)
                  throws java.lang.UnsupportedOperationException
 As this implementation only supports JDOM document as data
 source, this method throws an
 UnsupportedOperationException if the provided reader
 object does not implement the SAX XMLFilter
 interface.  Otherwise, the JDOM document reader will be
 attached as parent of the filter chain.
setXMLReader in class javax.xml.transform.sax.SAXSourcereader - a valid XMLReader or XMLFilter reference.java.lang.UnsupportedOperationException - if reader
                                         is not a SAX
                                         XMLFilter.getXMLReader()public org.xml.sax.XMLReader getXMLReader()
This implementation returns a specific XMLReader reading the XML data from the source JDOM document.
getXMLReader in class javax.xml.transform.sax.SAXSourceCopyright © 2021 Jason Hunter, Brett McLaughlin. All Rights Reserved.