bsys.xml.transformer
Class DomTransformer

java.lang.Object
  extended by bsys.xml.transformer.DomTransformer

public class DomTransformer
extends java.lang.Object

Transform (document to XML text)

Author:
Bernard Bou

Field Summary
private  boolean outputHtml
          Output as html
private  java.lang.String theDtd
          Dtd string
 
Constructor Summary
DomTransformer()
          Constructor
DomTransformer(boolean thisOutputHtmlFlag, java.lang.String thisDtd)
          Constructor
 
Method Summary
 org.w3c.dom.Document documentToDocument(org.w3c.dom.Document thisDocument, java.net.URL thisXslt)
          Transform DOM document to DOM document
 void documentToFile(org.w3c.dom.Document thisDocument, java.io.File thisOutputFile)
          Transform DOM document to XML file
 void documentToFile(org.w3c.dom.Document thisDocument, java.net.URL thisXsltUrl, java.io.File thisOutputFile)
          Transform DOM document to XML file after applying XSL transform
 void documentToStream(org.w3c.dom.Document thisDocument, java.io.OutputStream thisOutputStream)
          Transform DOM document to XML stream
 java.lang.String documentToString(org.w3c.dom.Document thisDocument)
          Transform DOM document to XML string
 java.lang.String documentToString(org.w3c.dom.Document thisDocument, java.io.File thisXsltFile)
          Transform DOM document to XML string after applying XSL transformation
 java.lang.String documentToString(org.w3c.dom.Document thisDocument, java.net.URL thisXsltUrl)
          Transform DOM document to XML string after applying XSL transformation
 org.w3c.dom.Document fileToDocument(java.net.URL thisXmlUrl, java.net.URL thisXsltUrl)
          File to document
 void fileToFile(java.lang.String thisInFilePath, java.lang.String thisOutFilePath, java.lang.String thisXsltFilePath)
          Transform XML file to XML file using XSLT file
protected  org.w3c.dom.Document toDocument(javax.xml.transform.Source thisSource, javax.xml.transform.Source thisXslt)
          Transform source to document
protected  void toFile(org.w3c.dom.Document thisDocument, javax.xml.transform.Source thisXslt, java.io.File thisFile)
          Transform DOM document to XML file
protected  void toStream(org.w3c.dom.Document thisDocument, javax.xml.transform.Source thisXslt, javax.xml.transform.stream.StreamResult thisResult)
          Transform DOM document to stream result
protected  java.lang.String toString(org.w3c.dom.Document thisDocument, javax.xml.transform.Source thisXslt)
          Transform DOM document to XML string
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

outputHtml

private boolean outputHtml
Output as html


theDtd

private java.lang.String theDtd
Dtd string

Constructor Detail

DomTransformer

public DomTransformer()
Constructor


DomTransformer

public DomTransformer(boolean thisOutputHtmlFlag,
                      java.lang.String thisDtd)
Constructor

Parameters:
thisOutputHtmlFlag - output as html
thisDtd - dtd id
Method Detail

fileToFile

public void fileToFile(java.lang.String thisInFilePath,
                       java.lang.String thisOutFilePath,
                       java.lang.String thisXsltFilePath)
                throws javax.xml.transform.TransformerException,
                       java.io.IOException
Transform XML file to XML file using XSLT file

Parameters:
thisInFilePath - in file
thisOutFilePath - out file
thisXsltFilePath - xslt file
Throws:
javax.xml.transform.TransformerException
java.io.IOException

documentToFile

public void documentToFile(org.w3c.dom.Document thisDocument,
                           java.io.File thisOutputFile)
                    throws javax.xml.transform.TransformerConfigurationException,
                           javax.xml.transform.TransformerException,
                           java.io.IOException
Transform DOM document to XML file

Parameters:
thisDocument - is the DOM Document to be output as XML
thisOutputFile - is the output file
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

documentToFile

public void documentToFile(org.w3c.dom.Document thisDocument,
                           java.net.URL thisXsltUrl,
                           java.io.File thisOutputFile)
                    throws javax.xml.transform.TransformerConfigurationException,
                           javax.xml.transform.TransformerException,
                           java.io.IOException
Transform DOM document to XML file after applying XSL transform

Parameters:
thisDocument - is the DOM Document to be output as XML
thisXsltUrl - is the XSLT source file
thisOutputFile - is the output file
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

documentToString

public java.lang.String documentToString(org.w3c.dom.Document thisDocument)
                                  throws javax.xml.transform.TransformerConfigurationException,
                                         javax.xml.transform.TransformerException,
                                         java.io.IOException
Transform DOM document to XML string

Parameters:
thisDocument - is the DOM Document to be output as XML
Returns:
XML String that represents DOM document
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

documentToString

public java.lang.String documentToString(org.w3c.dom.Document thisDocument,
                                         java.io.File thisXsltFile)
                                  throws javax.xml.transform.TransformerConfigurationException,
                                         javax.xml.transform.TransformerException,
                                         java.io.IOException
Transform DOM document to XML string after applying XSL transformation

Parameters:
thisDocument - is the DOM Document to be output as XML
thisXsltFile - is the XSLT source file
Returns:
XML String that represents DOM document
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

documentToString

public java.lang.String documentToString(org.w3c.dom.Document thisDocument,
                                         java.net.URL thisXsltUrl)
                                  throws javax.xml.transform.TransformerConfigurationException,
                                         javax.xml.transform.TransformerException,
                                         java.io.IOException
Transform DOM document to XML string after applying XSL transformation

Parameters:
thisDocument - is the DOM Document to be output as XML
thisXsltUrl - is the XSLT source url
Returns:
XML String that represents DOM document
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

documentToStream

public void documentToStream(org.w3c.dom.Document thisDocument,
                             java.io.OutputStream thisOutputStream)
                      throws javax.xml.transform.TransformerConfigurationException,
                             javax.xml.transform.TransformerException,
                             java.io.IOException
Transform DOM document to XML stream

Parameters:
thisDocument - is the DOM Document to be output as XML
thisOutputStream - is the output stream
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

fileToDocument

public org.w3c.dom.Document fileToDocument(java.net.URL thisXmlUrl,
                                           java.net.URL thisXsltUrl)
                                    throws javax.xml.transform.TransformerConfigurationException,
                                           javax.xml.transform.TransformerException,
                                           java.io.IOException
File to document

Parameters:
thisXmlUrl - XML document url
thisXsltUrl - XSL url
Returns:
document
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

documentToDocument

public org.w3c.dom.Document documentToDocument(org.w3c.dom.Document thisDocument,
                                               java.net.URL thisXslt)
                                        throws javax.xml.transform.TransformerConfigurationException,
                                               javax.xml.transform.TransformerException,
                                               java.io.IOException
Transform DOM document to DOM document

Parameters:
thisDocument - DOM document
thisXslt - XSLT url
Returns:
document
Throws:
java.io.IOException
javax.xml.transform.TransformerException
javax.xml.transform.TransformerConfigurationException

toString

protected java.lang.String toString(org.w3c.dom.Document thisDocument,
                                    javax.xml.transform.Source thisXslt)
                             throws javax.xml.transform.TransformerConfigurationException,
                                    javax.xml.transform.TransformerException,
                                    java.io.IOException
Transform DOM document to XML string

Parameters:
thisDocument - is the DOM Document to be output as XML
thisXslt - is the XSLT source
Returns:
XML String that represents DOM document
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

toFile

protected void toFile(org.w3c.dom.Document thisDocument,
                      javax.xml.transform.Source thisXslt,
                      java.io.File thisFile)
               throws javax.xml.transform.TransformerConfigurationException,
                      javax.xml.transform.TransformerException,
                      java.io.IOException
Transform DOM document to XML file

Parameters:
thisDocument - is the DOM Document to be output as XML
thisXslt - is the XSLT source
thisFile - output file
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

toStream

protected void toStream(org.w3c.dom.Document thisDocument,
                        javax.xml.transform.Source thisXslt,
                        javax.xml.transform.stream.StreamResult thisResult)
                 throws javax.xml.transform.TransformerConfigurationException,
                        javax.xml.transform.TransformerException,
                        java.io.IOException
Transform DOM document to stream result

Parameters:
thisDocument - is the DOM Document to be output as XML
thisXslt - is the XSLT source
thisResult - is the stream result
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException

toDocument

protected org.w3c.dom.Document toDocument(javax.xml.transform.Source thisSource,
                                          javax.xml.transform.Source thisXslt)
                                   throws javax.xml.transform.TransformerConfigurationException,
                                          javax.xml.transform.TransformerException,
                                          java.io.IOException
Transform source to document

Parameters:
thisSource - the source
thisXslt - the XSLT source
Returns:
document
Throws:
javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerException
java.io.IOException