org.sixdml.excelon
Class xlnXsltTransformService

java.lang.Object
  |
  +--org.sixdml.excelon.xlnServiceBase
        |
        +--org.sixdml.excelon.xlnXsltTransformService
All Implemented Interfaces:
Configurable, Service, SixdmlConstants, SixdmlTransformService

public class xlnXsltTransformService
extends xlnServiceBase
implements SixdmlTransformService, SixdmlConstants

  
 xlnXsltTransformService.java

 Performs XSLT ransformations on Nodes. 
 
 Created: Tue Jan 15 17:47:34 2002

 

Version:
1.0
Author:
Dare Obasanjo

Field Summary
private  com.exln.dxe.Session session
          A session provides the context in which an application can access XMLStores.
 
Fields inherited from class org.sixdml.excelon.xlnServiceBase
collection, properties
 
Fields inherited from interface org.sixdml.transform.SixdmlTransformService
XPATH2, XQUERY, XSLT
 
Fields inherited from interface org.sixdml.SixdmlConstants
SIXDML_NS, SIXDML_VERSION
 
Constructor Summary
(package private) xlnXsltTransformService(com.exln.dxe.Session session)
          Default constructor initializes service.
 
Method Summary
static String getContentsOfURL(URL source)
          Obtains the contents at a particular URL and returns them as a string.
 String getName()
          Gets the name of the service.
 org.sixdml.transform.SixdmlTransformType getType()
          Get the type of this object as a SixdmlTransformType.
 String transformAndReturnString(String transformCode, org.sixdml.SixdmlResource resource)
          Transforms a SixdmlResource from one XML document to another and returns the results in a string.
 String transformAndReturnString(String transformCode, String sourceXML)
          Transforms a string representation of a wellformed XML document to another and returns the results in a string.
 String transformAndReturnString(URL source, org.sixdml.SixdmlResource resource)
          Transforms a SixdmlResource from one XML document to another and returns the results in a string.
 String transformAndReturnString(URL source, String sourceXML)
          Transforms a SixdmlResource from one XML document to another and returns the results in a string.
 
Methods inherited from class org.sixdml.excelon.xlnServiceBase
getProperty, getVersion, setCollection, setProperty
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xmldb.api.base.Service
getVersion, setCollection
 
Methods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
 

Field Detail

session

private com.exln.dxe.Session session
A session provides the context in which an application can access XMLStores. An application needs a session to do anything with DXE

Constructor Detail

xlnXsltTransformService

xlnXsltTransformService(com.exln.dxe.Session session)
Default constructor initializes service.

Parameters:
session - the DXE session associated with the class.
Method Detail

getType

public org.sixdml.transform.SixdmlTransformType getType()
Get the type of this object as a SixdmlTransformType.

Specified by:
getType in interface SixdmlTransformService
Returns:
the type of this object.

transformAndReturnString

public String transformAndReturnString(URL source,
                                       org.sixdml.SixdmlResource resource)
                                throws IOException,
                                       InvalidTransformException
Transforms a SixdmlResource from one XML document to another and returns the results in a string. If the results are not XML then the root node will be a <transform-result< element from the http://www.25hoursaday.com/sixdml namespace containing the actual results in a CDATA child node.

Specified by:
transformAndReturnString in interface SixdmlTransformService
Parameters:
source - the URL to the location of the file containing the transform.
resource - the resource to transform
Returns:
the results of the transform in a string.
Throws:
IOException - if an error occurs while trying to retrieve the file.
InvalidTransformException - if the transform specified is an invalid or non-well formed query or document.

transformAndReturnString

public String transformAndReturnString(String transformCode,
                                       org.sixdml.SixdmlResource resource)
                                throws InvalidTransformException
Transforms a SixdmlResource from one XML document to another and returns the results in a string. If the results are not XML then the root node will be a <transform-result< element from the http://www.25hoursaday.com/sixdml namespace containing the actual results in a CDATA child node.

Specified by:
transformAndReturnString in interface SixdmlTransformService
Parameters:
transformCode - the actual code for the stylesheet or query.
resource - the resource to transform
Returns:
the results of the transform in a string.
Throws:
InvalidTransformException - if the transform specified is an invalid or non-well formed query or document.

transformAndReturnString

public String transformAndReturnString(String transformCode,
                                       String sourceXML)
                                throws InvalidTransformException,
                                       NonWellFormedXMLException
Transforms a string representation of a wellformed XML document to another and returns the results in a string.

Specified by:
transformAndReturnString in interface SixdmlTransformService
Parameters:
transformCode - the actual code for the stylesheet or query.
sourceXML - the XML to transform
Returns:
the results of the transform in a string.
Throws:
InvalidTransformException - if the transform specified is an invalid or non-well formed query or document.
NonWellFormedXMLException - if the data to transform is not a wellformed XML document.

transformAndReturnString

public String transformAndReturnString(URL source,
                                       String sourceXML)
                                throws IOException,
                                       InvalidTransformException,
                                       NonWellFormedXMLException
Transforms a SixdmlResource from one XML document to another and returns the results in a string.

Specified by:
transformAndReturnString in interface SixdmlTransformService
Parameters:
source - the URL to the location of the file containing the transform.
sourceXML - the XML to transform
Returns:
the results of the transform in a string.
Throws:
IOException - if an error occurs while trying to retrieve the file.
InvalidTransformException - if the transform specified is an invalid or non-well formed query or document.
NonWellFormedXMLException - if the data to transform is not a wellformed XML document.

getName

public String getName()
Gets the name of the service.

Specified by:
getName in interface Service
Specified by:
getName in class xlnServiceBase
Returns:
the name of the service.

getContentsOfURL

public static String getContentsOfURL(URL source)
                               throws IOException
Obtains the contents at a particular URL and returns them as a string.

Parameters:
source - the URL to obtaion the data from.
Returns:
the contents at the specified URL.
Throws:
IOException - if an error occurs while trying to retrieve the file.