org.objectweb.cjdbc.common.xml
Class XmlTools

java.lang.Object
  extended byorg.objectweb.cjdbc.common.xml.XmlTools

public final class XmlTools
extends java.lang.Object

This class defines a XmlTools

Version:
1.0
Author:
Nicolas Modrzyk

Field Summary
private static javax.xml.transform.Transformer infoTransformer
           
(package private) static Trace logger
          Logger instance.
private static javax.xml.transform.TransformerFactory tFactory
          XSL Transformation
 
Constructor Summary
XmlTools()
           
 
Method Summary
static java.lang.String applyXsl(java.lang.String xml, java.lang.String xsl)
          Apply xslt to xml
static java.lang.String insertCjdbcControllerDoctype(java.lang.String xml)
          Insert C-JDBC-CONTROLLER DOCTYPE in a XML file.
static java.lang.String insertCjdbcDoctype(java.lang.String xml)
          Insert C-JDBC DOCTYPE in a XML file.
static java.io.File internationalizeXsl(java.io.File xsl)
          Transform the xsl file so that it is internationalized.
static java.lang.String prettyXml(java.lang.String xml)
          Indent xml with xslt
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static Trace logger
Logger instance.


tFactory

private static javax.xml.transform.TransformerFactory tFactory
XSL Transformation


infoTransformer

private static javax.xml.transform.Transformer infoTransformer
Constructor Detail

XmlTools

public XmlTools()
Method Detail

prettyXml

public static java.lang.String prettyXml(java.lang.String xml)
                                  throws java.lang.Exception
Indent xml with xslt

Parameters:
xml - to indent
Returns:
indented xml
Throws:
java.lang.Exception - if an error occurs

applyXsl

public static java.lang.String applyXsl(java.lang.String xml,
                                        java.lang.String xsl)
Apply xslt to xml

Parameters:
xml - to transform
xsl - transformation to apply
Returns:
xml formatted string or error message

internationalizeXsl

public static java.io.File internationalizeXsl(java.io.File xsl)
                                        throws java.lang.Exception
Transform the xsl file so that it is internationalized.

Parameters:
xsl - xsl file
Returns:
internationalized file
Throws:
java.lang.Exception - if an error occurs

insertCjdbcDoctype

public static java.lang.String insertCjdbcDoctype(java.lang.String xml)
Insert C-JDBC DOCTYPE in a XML file. Ugly hack: the DOCTYPE is inserted this way since the DOCTYPE is stripped from the xml when applying the pretty xsl stylesheet and I could not find a way to access it from within the xsl. Any suggestion is welcome... Insert C-JDBC DOCTYPE after the <?xml ... ?> and before the rest of the content.

Parameters:
xml - XML content
Returns:
the xml where the C-JDBC DOCTYPE has been inserted so that the xml can be validated against this DTD
See Also:
XmlComponent.DOCTYPE_DB

insertCjdbcControllerDoctype

public static java.lang.String insertCjdbcControllerDoctype(java.lang.String xml)
Insert C-JDBC-CONTROLLER DOCTYPE in a XML file. Ugly hack: the DOCTYPE is inserted this way since the DOCTYPE is stripped from the xml when applying the pretty xsl stylesheet and I could not find a way to access it from within the xsl. Any suggestion is welcome... Insert C-JDBC-CONTROLLER DOCTYPE after the <?xml ... ?> and before the rest of the content.

Parameters:
xml - XML content
Returns:
the xml where the C-JDBC-CONTROLLER DOCTYPE has been inserted so that the xml can be validated against this DTD
See Also:
XmlComponent.DOCTYPE_CONTROLLER


Copyright © 2002, 2005 - ObjectWeb Consortium - All Rights Reserved.