Main Page   Packages   Namespace List   Class Hierarchy   Compound List   Compound Members  

JDOMSource Class Reference

List of all members.

Public Methods

 JDOMSource (Document source)
void setDocument (Document source)
Document getDocument ()
void setInputSource (InputSource inputSource) throws UnsupportedOperationException
void setXMLReader (XMLReader reader) throws UnsupportedOperationException
XMLReader getXMLReader ()

Static Public Attributes

final String JDOM_FEATURE

Detailed Description

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);
     }
   }
 

See also:
org.jdom.transform.JDOMResult
Author:
Laurent Bihanic , Jason Hunter
Version:
Revision:
1.6
,
Date:
2002/01/08 09:17:10


Constructor & Destructor Documentation

JDOMSource::JDOMSource Document    source [inline]
 

Creates a JDOM TRaX source wrapping a JDOM document.

Parameters:
source  the JDOM document to use as source for the transformations
Exceptions:
NullPointerException  if source is null.
See also:
setDocument


Member Function Documentation

Document JDOMSource::getDocument   [inline]
 

Returns the source document used by this TRaX source.

Returns:
the source document used by this TRaX source or null if none has been set.
See also:
setDocument

XMLReader JDOMSource::getXMLReader   [inline]
 

Returns the XMLReader to be used for the Source.

This implementation returns a specific XMLReader reading the XML data from the source JDOM document.

Returns:
an XMLReader reading the XML data from the source JDOM document.

void JDOMSource::setDocument Document    source [inline]
 

Sets the source document used by this TRaX source.

Parameters:
source  the JDOM document to use as source for the transformations
Exceptions:
NullPointerException  if source is null.
See also:
getDocument

void JDOMSource::setInputSource InputSource    inputSource [inline]
 

Sets the SAX InputSource to be used for the Source.

As this implementation only supports JDOM document as data source, this method always throws an UnsupportedOperationException.

Parameters:
inputSource  a valid InputSource reference.
Exceptions:
UnsupportedOperationException  always!

void JDOMSource::setXMLReader XMLReader    reader [inline]
 

Set the XMLReader to be used for the Source.

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.

Parameters:
reader  a valid XMLReader or XMLFilter reference.
Exceptions:
UnsupportedOperationException  always!
See also:
getXMLReader


Member Data Documentation

final String JDOMSource::JDOM_FEATURE [static]
 

Initial value:

                      "http://org.jdom.transform.JDOMSource/feature"
If returns true when passed this value as an argument, the Transformer natively supports JDOM.

Note: This implementation does not override the value defined by its superclass to be considered as a SAXSource by Transformer implementations not natively supporting JDOM.


The documentation for this class was generated from the following file:
Generated on Sat Mar 30 18:53:03 2002 for JDOM by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001