org.infoglue.cms.util
Class XMLHelper

java.lang.Object
  extended by org.infoglue.cms.util.XMLHelper

public class XMLHelper
extends java.lang.Object

This class is an utility class meant to be filled with reusable snippets of code concerning handling of XML in different shapes. No application specific code can be put here!!!

Author:
Mattias Bogeblad

Constructor Summary
XMLHelper()
           
 
Method Summary
static org.w3c.dom.Document readDocumentFromByteArray(byte[] xml)
          This method fetches the document-root(DOM) from a xml-document located in a byte[] specified by user argument.
static org.w3c.dom.Document readDocumentFromFile(java.io.File xmlFile)
          This method fetches the document-root(DOM) from a xml-document located on disc specified by user argument.
static java.lang.String replaceSpecialCharacters(java.lang.String value)
          This method replaces special character with their xml-counterpart.
static java.lang.StringBuffer serializeDom(org.w3c.dom.Node node, java.lang.StringBuffer writeString)
          Serializes the DOM-tree to a stringBuffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLHelper

public XMLHelper()
Method Detail

serializeDom

public static java.lang.StringBuffer serializeDom(org.w3c.dom.Node node,
                                                  java.lang.StringBuffer writeString)
Serializes the DOM-tree to a stringBuffer. Recursive method!

Parameters:
node - Node to start examining the tree from.
writeString - The StringBuffer you want to fill with xml.
Returns:
The StringBuffer containing the xml.
Since:
2002-12-12

replaceSpecialCharacters

public static java.lang.String replaceSpecialCharacters(java.lang.String value)
This method replaces special character with their xml-counterpart.


readDocumentFromFile

public static org.w3c.dom.Document readDocumentFromFile(java.io.File xmlFile)
                                                 throws java.io.IOException,
                                                        org.xml.sax.SAXException
This method fetches the document-root(DOM) from a xml-document located on disc specified by user argument.

Throws:
java.io.IOException
org.xml.sax.SAXException
Since:
2002-12-16

readDocumentFromByteArray

public static org.w3c.dom.Document readDocumentFromByteArray(byte[] xml)
                                                      throws java.io.IOException,
                                                             org.xml.sax.SAXException
This method fetches the document-root(DOM) from a xml-document located in a byte[] specified by user argument.

Throws:
java.io.IOException
org.xml.sax.SAXException
Since:
2002-12-16


Copyright © 2005 InfoGlue.org All Rights Reserved.