com.taleo.integration.client.customstep.util.xml
Class XmlUtils

java.lang.Object
  extended by com.taleo.integration.client.customstep.util.xml.XmlUtils

public abstract class XmlUtils
extends java.lang.Object

XML Utilities.

Author:
Romain Guay - Taleo Corporation

Constructor Summary
XmlUtils()
           
 
Method Summary
static org.w3c.dom.Document createDomDocument()
          Create an empty XML Document.
static org.w3c.dom.Document createDomDocument(java.io.InputStream is)
          Create an XML Document from an InputStream.
static org.w3c.dom.Document createDomDocument(java.lang.String xml)
          Create an XML Document from an XML string.
static boolean isWellFormed(java.io.File file)
          Indicates if the specified file is a well formed XML document.
static boolean isWellFormed(java.lang.String xml)
          Indicates if the specified XML string is well formed.
static java.lang.String stripInvalidXMLCharacters(java.lang.String text)
          Strip invalid XML characters from a string.
static java.lang.String toXml(org.w3c.dom.Node node)
          Convert a DOM node to an XML string.
static java.lang.String toXml(org.w3c.dom.Node node, int indent)
          Convert a DOM node to an XML string.
static void writeXml(org.w3c.dom.Document document, java.io.File file)
          Write a DOM document to a file.
static void writeXml(org.w3c.dom.Document document, java.io.OutputStream os)
          Write a DOM document to an OutputStream.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlUtils

public XmlUtils()
Method Detail

isWellFormed

public static boolean isWellFormed(java.io.File file)
                            throws java.io.IOException
Indicates if the specified file is a well formed XML document.

Parameters:
file - The file containing the document.
Returns:
Throws:
java.io.IOException

isWellFormed

public static boolean isWellFormed(java.lang.String xml)
                            throws java.io.IOException
Indicates if the specified XML string is well formed.

Parameters:
xml - The XML string.
Returns:
Throws:
java.io.IOException

createDomDocument

public static org.w3c.dom.Document createDomDocument()
Create an empty XML Document.

Returns:

createDomDocument

public static org.w3c.dom.Document createDomDocument(java.lang.String xml)
                                              throws org.xml.sax.SAXException,
                                                     java.io.IOException
Create an XML Document from an XML string.

Parameters:
xml -
Returns:
Throws:
java.io.IOException
org.xml.sax.SAXException

createDomDocument

public static org.w3c.dom.Document createDomDocument(java.io.InputStream is)
                                              throws java.io.IOException
Create an XML Document from an InputStream.

Parameters:
is -
Returns:
Throws:
java.io.IOException

writeXml

public static void writeXml(org.w3c.dom.Document document,
                            java.io.File file)
                     throws java.io.IOException
Write a DOM document to a file.

Parameters:
document -
file -
Throws:
java.io.IOException

writeXml

public static void writeXml(org.w3c.dom.Document document,
                            java.io.OutputStream os)
                     throws java.io.IOException
Write a DOM document to an OutputStream.

Parameters:
document -
os -
Throws:
java.io.IOException

toXml

public static java.lang.String toXml(org.w3c.dom.Node node,
                                     int indent)
Convert a DOM node to an XML string.

Parameters:
node -
indent -
Returns:

toXml

public static java.lang.String toXml(org.w3c.dom.Node node)
Convert a DOM node to an XML string.

Parameters:
node -
Returns:

stripInvalidXMLCharacters

public static java.lang.String stripInvalidXMLCharacters(java.lang.String text)
Strip invalid XML characters from a string.

Parameters:
text -
Returns: