org.jboss.portal.common.util
Class XML

java.lang.Object
  extended by org.jboss.portal.common.util.XML

public class XML
extends java.lang.Object

A set of XMl utilities.


Field Summary
static java.lang.String XML_LANG_NAMESPACE_URI
          Namespace URI for XML lang.
 
Constructor Summary
XML()
           
 
Method Summary
static java.lang.String asString(org.w3c.dom.Element element)
          Get the element's content as a string.
static org.w3c.dom.NodeList getChildren(org.w3c.dom.Element element, java.lang.String name)
           
static javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
          Return the builder factory.
static org.w3c.dom.Element getSingleChild(org.w3c.dom.Element element, java.lang.String name, boolean strict)
           
static org.w3c.dom.Document toDocument(java.lang.String text)
          Parse a string into a document.
static org.w3c.dom.Element toElement(java.lang.String text)
          Parse a string into an element.
static java.lang.String toString(org.w3c.dom.Document doc)
          Serialize the document with the default format : - No XML declaration - Indented - Encoding is UTF-8
static java.lang.String toString(org.w3c.dom.Document doc, java.util.Properties format)
          Converts an document to a String representation.
static java.lang.String toString(org.w3c.dom.Element element)
           
static java.lang.String toString(org.w3c.dom.Element element, java.util.Properties properties)
          Converts an element to a String representation.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_LANG_NAMESPACE_URI

public static final java.lang.String XML_LANG_NAMESPACE_URI
Namespace URI for XML lang.

See Also:
Constant Field Values
Constructor Detail

XML

public XML()
Method Detail

getDocumentBuilderFactory

public static javax.xml.parsers.DocumentBuilderFactory getDocumentBuilderFactory()
Return the builder factory.


toString

public static final java.lang.String toString(org.w3c.dom.Element element,
                                              java.util.Properties properties)
                                       throws javax.xml.parsers.ParserConfigurationException,
                                              javax.xml.transform.TransformerException
Converts an element to a String representation.

Throws:
javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerException

toString

public static final java.lang.String toString(org.w3c.dom.Element element)
                                       throws javax.xml.parsers.ParserConfigurationException,
                                              javax.xml.transform.TransformerException
Throws:
javax.xml.parsers.ParserConfigurationException
javax.xml.transform.TransformerException
See Also:
toString(Document)

toString

public static final java.lang.String toString(org.w3c.dom.Document doc)
                                       throws javax.xml.transform.TransformerException
Serialize the document with the default format : - No XML declaration - Indented - Encoding is UTF-8

Throws:
javax.xml.transform.TransformerException
See Also:
toString(Document,Properties)

toString

public static java.lang.String toString(org.w3c.dom.Document doc,
                                        java.util.Properties format)
                                 throws javax.xml.transform.TransformerException
Converts an document to a String representation.

Throws:
javax.xml.transform.TransformerException

toDocument

public static org.w3c.dom.Document toDocument(java.lang.String text)
                                       throws javax.xml.parsers.ParserConfigurationException,
                                              org.xml.sax.SAXException,
                                              java.io.IOException
Parse a string into a document.

Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

toElement

public static org.w3c.dom.Element toElement(java.lang.String text)
                                     throws javax.xml.parsers.ParserConfigurationException,
                                            org.xml.sax.SAXException,
                                            java.io.IOException
Parse a string into an element.

Throws:
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException

asString

public static java.lang.String asString(org.w3c.dom.Element element)
Get the element's content as a string.


getSingleChild

public static org.w3c.dom.Element getSingleChild(org.w3c.dom.Element element,
                                                 java.lang.String name,
                                                 boolean strict)

getChildren

public static org.w3c.dom.NodeList getChildren(org.w3c.dom.Element element,
                                               java.lang.String name)