org.gcube.datatransformation.datatransformationlibrary.programs.metadata.util
Class XMLStringParser

java.lang.Object
  extended by org.gcube.datatransformation.datatransformationlibrary.programs.metadata.util.XMLStringParser

public class XMLStringParser
extends Object

This class provides two helper methods which are used in order to convert between XML DOM trees and their string representation.

Author:
Spyros Boutsis, UoA

Constructor Summary
XMLStringParser()
           
 
Method Summary
static Document parseXMLString(String XMLdoc)
          Parses an XML string and transforms it to a DOM tree.
static String XMLDocToString(Node root)
          Converts a XML DOM tree to a XML string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLStringParser

public XMLStringParser()
Method Detail

parseXMLString

public static Document parseXMLString(String XMLdoc)
                               throws ParserConfigurationException,
                                      SAXException,
                                      IOException
Parses an XML string and transforms it to a DOM tree.

Parameters:
XMLdoc - The XML string to parse
Returns:
A Document object describing the DOM tree
Throws:
ParserConfigurationException - an error occured
SAXException - an error occured
IOException - an error occured

XMLDocToString

public static String XMLDocToString(Node root)
                             throws Exception
Converts a XML DOM tree to a XML string.

Parameters:
root - A Node object representing the root of the DOM tree to convert to a string.
Returns:
The XML string
Throws:
Exception - an error occured


Copyright © 2013. All Rights Reserved.