Main Page | Class Hierarchy | Class List | Class Members | Related Pages

org::jdom::transform::JDOMSource Class Reference

List of all members.

Public Member Functions

 JDOMSource (Document source)
 JDOMSource (List source)
 JDOMSource (Element source)
void setDocument (Document source)
Document getDocument ()
void setNodes (List source)
List getNodes ()
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 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: <blockquote>

   public static List 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.getResult();
     }
     catch (TransformerException e) {
       throw new JDOMException("XSLT Trandformation failed", e);
     }
   }
 
</blockquote>

See also:
org.jdom.transform.JDOMResult
Author:
Laurent Bihanic

Jason Hunter

Version:
Revision
1.14
,
Date
2003/04/21 06:40:31


Constructor & Destructor Documentation

org::jdom::transform::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:
IllegalArgumentException if source is null.

org::jdom::transform::JDOMSource::JDOMSource List  source  )  [inline]
 

Creates a JDOM TRaX source wrapping a list of JDOM nodes.

Parameters:
source the JDOM nodes to use as source for the transformations
Exceptions:
IllegalArgumentException if source is null.

org::jdom::transform::JDOMSource::JDOMSource Element  source  )  [inline]
 

Creates a JDOM TRaX source wrapping a JDOM element.

Parameters:
source the JDOM element to use as source for the transformations
Exceptions:
IllegalArgumentException if source is null.


Member Function Documentation

Document org::jdom::transform::JDOMSource::getDocument  )  [inline]
 

Returns the source document used by this TRaX source.

Returns:
the source document used by this TRaX source or null if the source is a node list.
See also:
setDocument

List org::jdom::transform::JDOMSource::getNodes  )  [inline]
 

Returns the source node list used by this TRaX source.

Returns:
the source node list used by this TRaX source or null if the source is a JDOM document.
See also:
setDocument

XMLReader org::jdom::transform::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 org::jdom::transform::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:
IllegalArgumentException if source is null.
See also:
getDocument

void org::jdom::transform::JDOMSource::setInputSource InputSource  inputSource  )  throws UnsupportedOperationException [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 org::jdom::transform::JDOMSource::setNodes List  source  )  [inline]
 

Sets the source node list used by this TRaX source.

Parameters:
source the JDOM nodes to use as source for the transformations
Exceptions:
IllegalArgumentException if source is null.
See also:
getNodes

void org::jdom::transform::JDOMSource::setXMLReader XMLReader  reader  )  throws UnsupportedOperationException [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 if reader is not a SAX XMLFilter.
See also:
getXMLReader


Member Data Documentation

final String org::jdom::transform::JDOMSource::JDOM_FEATURE [static]
 

Initial value:

                      "http://org.jdom.transform.JDOMSource/feature"
If javax.xml.transform.TransformerFactory#getFeature 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.


The documentation for this class was generated from the following file:
Generated on Tue Oct 26 18:17:01 2004 for JDOM by  doxygen 1.3.9.1