Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.jxbeans.transformation
Class XMLTransformer  view XMLTransformer download XMLTransformer.java

java.lang.Object
  extended byorg.jxbeans.AbstractJXBean
      extended byorg.jxbeans.AbstractDocumentSource
          extended byorg.jxbeans.AbstractTransformerJXBean
              extended byorg.jxbeans.transformation.XMLTransformer
All Implemented Interfaces:
org.jxbeans.DocumentReadyListener, org.jxbeans.DocumentSource, java.util.EventListener, java.io.Serializable

public class XMLTransformer
extends org.jxbeans.AbstractTransformerJXBean
implements org.jxbeans.DocumentReadyListener

The XMLTransformer JXBean will transform the incoming XML document using an XSLT "tranformation sheet". Since XSLT can be used to tranform XML into something other than XML (e.g., plain text output, HTML, etc.), this class provides a way to direct its output directly to a file name, File or Writer. If any of these properties is set the transformed output will not be forwarded to the DocumentReadyListeners.

The precedence of usage of the output destination is:

  1. Writer
  2. File (if the Writer is null)
  3. file name (if the File is null)

Since:
1.0
Version:
1.0

Field Summary
private  java.io.File file
           
private  java.lang.String fileName
           
private  java.lang.String publicID
           
private  java.lang.String systemID
           
private  java.io.Writer writer
           
 
Fields inherited from class org.jxbeans.AbstractTransformerJXBean
 
Fields inherited from class org.jxbeans.AbstractDocumentSource
listeners
 
Fields inherited from class org.jxbeans.AbstractJXBean
 
Constructor Summary
XMLTransformer()
           
 
Method Summary
 void documentReady(org.jxbeans.DocumentReadyEvent anEvent)
          Classes implementing this method are expected to process the document contained in the DocumentReadyEvent in some fashion specific to the class implementing this interface.
 java.io.File getFile()
           
 java.lang.String getFileName()
           
 java.lang.String getPublicID()
           
 java.lang.String getSystemID()
           
 java.io.Writer getWriter()
           
 void setFile(java.io.File aFile)
          Sets the File to which the transformer will write the output document.
 void setFileName(java.lang.String aFileName)
          Sets the file name to which the transformer will write the output document.
 void setPublicID(java.lang.String aPublicID)
          Sets the DOCTYPE "public ID" to be used on the output document if a File, file name or Writer is not set.
 void setSystemID(java.lang.String aSystemID)
          Sets the DOCTYPE "system ID" to be used on the output document if a File, file name or Writer is not set.
 void setWriter(java.io.Writer aWriter)
          Sets the Writer to which the transformer will write the output document.
 
Methods inherited from class org.jxbeans.AbstractTransformerJXBean
getTransformationFile, getTransformationFileName, getTransformationURL, getTransformer, setTransformationFile, setTransformationFileName, setTransformationURL
 
Methods inherited from class org.jxbeans.AbstractDocumentSource
addDocumentReadyListener, forwardDocument, forwardDocument, getDocumentReadyListeners, logDocument, removeDocumentReadyListener
 
Methods inherited from class org.jxbeans.AbstractJXBean
getName, logErrorAndRaiseException, logMethodEntry, logMethodEntry, logMethodExit, logMethodExit, setName
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

systemID

private java.lang.String systemID

publicID

private java.lang.String publicID

writer

private transient java.io.Writer writer

file

private java.io.File file

fileName

private java.lang.String fileName
Constructor Detail

XMLTransformer

public XMLTransformer()
Method Detail

documentReady

public void documentReady(org.jxbeans.DocumentReadyEvent anEvent)
                   throws org.jxbeans.JXBeanException
Description copied from interface: org.jxbeans.DocumentReadyListener
Classes implementing this method are expected to process the document contained in the DocumentReadyEvent in some fashion specific to the class implementing this interface.

Specified by:
documentReady in interface org.jxbeans.DocumentReadyListener

setWriter

public void setWriter(java.io.Writer aWriter)
Sets the Writer to which the transformer will write the output document.

Since:
1.0

getWriter

public java.io.Writer getWriter()
Since:
1.0

setFile

public void setFile(java.io.File aFile)
Sets the File to which the transformer will write the output document.

Since:
1.0

getFile

public java.io.File getFile()
Since:
1.0

setFileName

public void setFileName(java.lang.String aFileName)
Sets the file name to which the transformer will write the output document.

Since:
1.0

getFileName

public java.lang.String getFileName()
Since:
1.0

setSystemID

public void setSystemID(java.lang.String aSystemID)
Sets the DOCTYPE "system ID" to be used on the output document if a File, file name or Writer is not set. NOTE: This is a bit of hack to get around a problem with JDOMResult, which is being used when we are not transforming to a File, file name or Writer. The problem is that the <xsl:output> element in an XSLT transformation sheet is ignored, so the DOCTYPE declaration is lost.

Since:
1.0

getSystemID

public java.lang.String getSystemID()
Since:
1.0

setPublicID

public void setPublicID(java.lang.String aPublicID)
Sets the DOCTYPE "public ID" to be used on the output document if a File, file name or Writer is not set. NOTE: This is a bit of hack to get around a problem with JDOMResult, which is being used when we are not transforming to a File, FileName or Writer. The problem is that the element in an XSLT transformation sheet is ignored, so the DOCTYPE declaration is lost.

Since:
1.0

getPublicID

public java.lang.String getPublicID()
Since:
1.0