|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.xml.transform.sax.SAXSource | +--org.jdom.transform.JDOMSource
Acts as an holder for JDOM document sources.
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); } }
JDOMResult
Field Summary | |
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. |
Fields inherited from class javax.xml.transform.sax.SAXSource |
FEATURE |
Constructor Summary | |
JDOMSource(Document source)
Creates a JDOM TRaX source wrapping a JDOM document. |
Method Summary | |
Document |
getDocument()
Returns the source document 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 |
setXMLReader(org.xml.sax.XMLReader reader)
Set the XMLReader to be used for the Source. |
Methods inherited from class javax.xml.transform.sax.SAXSource |
getInputSource, getSystemId, setSystemId, sourceToInputSource |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
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.
Constructor Detail |
public JDOMSource(Document source)
source
- the JDOM document to use as source for the
transformationsNullPointerException
- if source
is
null
.setDocument(org.jdom.Document)
Method Detail |
public void setDocument(Document source)
source
- the JDOM document to use as source for the
transformationsNullPointerException
- if source
is
null
.getDocument()
public Document getDocument()
null
if none has been set.setDocument(org.jdom.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.SAXSource
inputSource
- 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.SAXSource
reader
- a valid XMLReader or XMLFilter reference.java.lang.UnsupportedOperationException
- always!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.SAXSource
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |