es.caib.ibkey.utils
Class XMLUtils

java.lang.Object
  extended by es.caib.ibkey.utils.XMLUtils

public class XMLUtils
extends java.lang.Object


Constructor Summary
XMLUtils()
           
 
Method Summary
static org.w3c.dom.Document parse(java.io.InputStream inStr)
          Parses XML file and returns XML document.
static boolean saveXMLDocument(java.lang.String fileName, org.w3c.dom.Document doc)
          Saves XML Document into XML file.
static byte[] XMLNodeToByteArray(org.w3c.dom.Node doc)
          returns XML in byte[] form Modification of code written by Martin Glogar at http://labe.felk.cvut.cz/~xfaigl/mep/xml/java-xml.htm
 
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

XMLNodeToByteArray

public static byte[] XMLNodeToByteArray(org.w3c.dom.Node doc)
                                 throws javax.xml.transform.TransformerException,
                                        java.io.IOException
returns XML in byte[] form Modification of code written by Martin Glogar at http://labe.felk.cvut.cz/~xfaigl/mep/xml/java-xml.htm

Parameters:
doc - XML document to save
Returns:
xml in byte [] form
Throws:
javax.xml.transform.TransformerException
java.io.IOException

saveXMLDocument

public static boolean saveXMLDocument(java.lang.String fileName,
                                      org.w3c.dom.Document doc)
                               throws javax.xml.transform.TransformerException,
                                      java.io.IOException
Saves XML Document into XML file.

Parameters:
fileName - XML file name
doc - XML document to save
Returns:
true if method success false otherwise
Throws:
javax.xml.transform.TransformerException
java.io.IOException

parse

public static org.w3c.dom.Document parse(java.io.InputStream inStr)
                                  throws javax.xml.parsers.ParserConfigurationException,
                                         org.xml.sax.SAXException,
                                         java.io.IOException
Parses XML file and returns XML document.

Parameters:
fileName - XML file to parse
Returns:
XML document or null if error occured
Throws:
java.io.IOException
javax.xml.parsers.ParserConfigurationException
org.xml.sax.SAXException
java.io.IOException


Copyright © 2012 Direcció General de Tecnologia i Comunicacions. Govern de les Illes Balears. All Rights Reserved.