fr.paris.lutece.util.xml
Class XmlUtil

java.lang.Object
  extended by fr.paris.lutece.util.xml.XmlUtil

public final class XmlUtil
extends java.lang.Object

This class provides utils for XML document management.


Field Summary
static java.lang.String PROPERTIES_XML_HEADER
           
 
Method Summary
static void addElement(java.lang.StringBuffer strXmlBuffer, java.lang.String strTag, int nValue)
          Add an element to an XML document buffer.
static void addElement(java.lang.StringBuffer strXmlBuffer, java.lang.String strTag, java.lang.String strValue)
          Add an element to an XML document buffer
static void addElementHtml(java.lang.StringBuffer strXmlBuffer, java.lang.String strTag, java.lang.String strValue)
          Add a CDATA type element to XML document buffer.
static void addEmptyElement(java.lang.StringBuffer strXmlBuffer, java.lang.String strTag, java.util.Map attrList)
          Add an empty element (< />) to an XML document buffer.
static void beginElement(java.lang.StringBuffer strXmlBuffer, java.lang.String strTag)
          Add an opening tag for an element in a XML document buffer
static void beginElement(java.lang.StringBuffer strXmlBuffer, java.lang.String strTag, java.util.Map attrList)
          Add an opening tag for an element in a XML document buffer
static void endElement(java.lang.StringBuffer strXmlBuffer, java.lang.String strTag)
          Add a closing tag for an element in a XML document buffer
static java.lang.String getXmlHeader()
          Gets the header of an XML file
static java.lang.String transform(javax.xml.transform.Source source, javax.xml.transform.Source stylesheet, java.util.Map<java.lang.String,java.lang.String> params, java.util.Properties outputProperties)
          This method performs XSL Transformation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTIES_XML_HEADER

public static final java.lang.String PROPERTIES_XML_HEADER
See Also:
Constant Field Values
Method Detail

getXmlHeader

public static java.lang.String getXmlHeader()
Gets the header of an XML file

Returns:
The header

transform

public static java.lang.String transform(javax.xml.transform.Source source,
                                         javax.xml.transform.Source stylesheet,
                                         java.util.Map<java.lang.String,java.lang.String> params,
                                         java.util.Properties outputProperties)
                                  throws java.lang.Exception
This method performs XSL Transformation.

Parameters:
source - The input XML document
stylesheet - The XSL stylesheet
params - parameters to apply to the XSL Stylesheet
outputProperties - properties to use for the xsl transform. Will overload the xsl output definition.
Returns:
The output document transformed
Throws:
java.lang.Exception - The exception

addElement

public static void addElement(java.lang.StringBuffer strXmlBuffer,
                              java.lang.String strTag,
                              java.lang.String strValue)
Add an element to an XML document buffer

Parameters:
strXmlBuffer - The XML document buffer
strTag - The tag name of the element to add
strValue - The value of the element

addEmptyElement

public static void addEmptyElement(java.lang.StringBuffer strXmlBuffer,
                                   java.lang.String strTag,
                                   java.util.Map attrList)
Add an empty element (< />) to an XML document buffer.

Parameters:
strXmlBuffer - The XML document buffer
strTag - The tag name of the element to add
attrList - The attributes list

addElement

public static void addElement(java.lang.StringBuffer strXmlBuffer,
                              java.lang.String strTag,
                              int nValue)
Add an element to an XML document buffer.

Parameters:
strXmlBuffer - The XML document buffer
strTag - The tag name of the element to add
nValue - The value of the element

addElementHtml

public static void addElementHtml(java.lang.StringBuffer strXmlBuffer,
                                  java.lang.String strTag,
                                  java.lang.String strValue)
Add a CDATA type element to XML document buffer.

Parameters:
strXmlBuffer - The XML document buffer
strTag - The tag name of the element to add
strValue - The value of the element

beginElement

public static void beginElement(java.lang.StringBuffer strXmlBuffer,
                                java.lang.String strTag)
Add an opening tag for an element in a XML document buffer

Parameters:
strXmlBuffer - The XML document buffer
strTag - The tag name of the element to add

beginElement

public static void beginElement(java.lang.StringBuffer strXmlBuffer,
                                java.lang.String strTag,
                                java.util.Map attrList)
Add an opening tag for an element in a XML document buffer

Parameters:
strXmlBuffer - The XML document buffer
strTag - The tag name of the element to add
attrList - The attributes list

endElement

public static void endElement(java.lang.StringBuffer strXmlBuffer,
                              java.lang.String strTag)
Add a closing tag for an element in a XML document buffer

Parameters:
strXmlBuffer - The XML document buffer
strTag - The tag name of the element to add


Copyright © 2009 Mairie de Paris. All Rights Reserved.