© 2006-2007 ETH Zurich

org.ximtec.igesture.util
Class XMLTool

java.lang.Object
  extended by org.ximtec.igesture.util.XMLTool

public class XMLTool
extends Object

Provides static methods with XML import/export functionality.

Version:
1.0, Dec 2006
Author:
Ueli Kurmann, igesture@uelikurmann.ch, Beat Signer, signer@inf.ethz.ch

Field Summary
static String ROOT_TAG
           
static String TEST_SETS_TAG
           
 
Constructor Summary
XMLTool()
           
 
Method Summary
static String exportBatchResultSet(BatchResultSet resultSet)
          Exports a batch result set to its XML representation.
static void exportBatchResultSet(BatchResultSet resultSet, File file)
          Exports a batch result set.
static void exportConfiguration(Configuration configuration, File file)
          Exports a configuration.
static InputStream exportConfigurationAsStream(Configuration configuration)
          Exports a Configuration as XML Stream
static void exportGestureSet(GestureSet set, File file)
          Exports a gesture set.
static void exportGestureSet(List<GestureSet> sets, File file)
          Exports a list of gesture sets.
static InputStream exportGestureSetAsStream(GestureSet set)
          Exports a Gesture Set as Input Stream
static InputStream exportGestureSetsAsStream(List<GestureSet> sets)
          Exports a list of Gesture Sets as InputStream
static void exportTestSet(List<TestSet> testSetList, File file)
          Exports a list of test sets.
static void exportTestSet(TestSet testSet, File file)
          Exports a test set.
static InputStream exportTestSetAsStream(TestSet testSet)
          Exports a Test Set as XML Stream
static BatchProcessContainer importBatchProcessContainer(File file)
          Imports an XML File and builds up the object tree.
static Configuration importConfiguration(File file)
          Imports a configuration
static Configuration importConfiguration(InputStream inputStream)
          Imports a configuration.
static org.jdom.Document importDocument(File file)
          Imports an XML Document from a file.
static org.jdom.Document importDocument(InputStream inputStream)
          Imports an XML document.
static GestureSet importGestureSet(File file)
           
static GestureSet importGestureSet(InputStream inputStream)
          Imports a gesture set.
static TestSet importTestSet(File file)
          Imports a list of test sets.
static TestSet importTestSet(InputStream inputStream)
          Imports a list of test sets from an XML document.
static String transform(String xmlDocument, InputStream xsl)
          XSL transformation.
static String transform(String xmlDocument, String xslFile)
          Transforms an XML Document using XSLT
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ROOT_TAG

public static final String ROOT_TAG
See Also:
Constant Field Values

TEST_SETS_TAG

public static final String TEST_SETS_TAG
See Also:
Constant Field Values
Constructor Detail

XMLTool

public XMLTool()
Method Detail

importGestureSet

public static GestureSet importGestureSet(InputStream inputStream)
Imports a gesture set.

Parameters:
file - the XML file.
Returns:
a list of gesture sets.

importGestureSet

public static GestureSet importGestureSet(File file)

exportGestureSet

public static void exportGestureSet(GestureSet set,
                                    File file)
Exports a gesture set.

Parameters:
set - the gesture set to be exported.
file - the XML file.

exportGestureSetAsStream

public static InputStream exportGestureSetAsStream(GestureSet set)
Exports a Gesture Set as Input Stream

Parameters:
set -
Returns:

exportGestureSetsAsStream

public static InputStream exportGestureSetsAsStream(List<GestureSet> sets)
Exports a list of Gesture Sets as InputStream

Parameters:
sets -
Returns:

exportGestureSet

public static void exportGestureSet(List<GestureSet> sets,
                                    File file)
Exports a list of gesture sets.

Parameters:
sets - the gesture sets to be exported.
file - the XML file.

exportTestSet

public static void exportTestSet(TestSet testSet,
                                 File file)
Exports a test set.

Parameters:
testSet - the test set to be exported.
file - the XML file.

exportTestSet

public static void exportTestSet(List<TestSet> testSetList,
                                 File file)
Exports a list of test sets.

Parameters:
testSetList - the list of test sets to be exported.
file - the XML file.

importTestSet

public static TestSet importTestSet(File file)
Imports a list of test sets.

Parameters:
file - the XML File
Returns:
a list of GestureSets

importTestSet

public static TestSet importTestSet(InputStream inputStream)
Imports a list of test sets from an XML document.

Parameters:
inputStream - the input stream of the XML document
Returns:
a list of test sets

importConfiguration

public static Configuration importConfiguration(InputStream inputStream)
Imports a configuration.

Parameters:
file - the XML file
Returns:
the configuration.

importConfiguration

public static Configuration importConfiguration(File file)
Imports a configuration

Parameters:
file -
Returns:

exportConfiguration

public static void exportConfiguration(Configuration configuration,
                                       File file)
Exports a configuration.

Parameters:
configuration - the configuration to be exported.
file - the XML file.

exportConfigurationAsStream

public static InputStream exportConfigurationAsStream(Configuration configuration)
Exports a Configuration as XML Stream

Parameters:
configuration -
Returns:
a Configuration as XML InputStream

exportTestSetAsStream

public static InputStream exportTestSetAsStream(TestSet testSet)
Exports a Test Set as XML Stream

Parameters:
testSet -
Returns:
a TestSet as XML InputStreamd

exportBatchResultSet

public static void exportBatchResultSet(BatchResultSet resultSet,
                                        File file)
Exports a batch result set.

Parameters:
resultSet - the batch result set to be exported
file - the XML file

exportBatchResultSet

public static String exportBatchResultSet(BatchResultSet resultSet)
Exports a batch result set to its XML representation.

Parameters:
resultSet - the batch result set to be exported.
Returns:
the string containing the XML representation.

importDocument

public static org.jdom.Document importDocument(InputStream inputStream)
Imports an XML document.

Parameters:
file - the XML file.
Returns:
the JDOM document.

importDocument

public static org.jdom.Document importDocument(File file)
Imports an XML Document from a file.

Parameters:
file -
Returns:

importBatchProcessContainer

public static BatchProcessContainer importBatchProcessContainer(File file)
Imports an XML File and builds up the object tree. The result is a list of batch algorithm instances.

Parameters:
file - the XML file to be imported.
Returns:
list of batch algorithm instances.

transform

public static String transform(String xmlDocument,
                               String xslFile)
                        throws TransformerException,
                               TransformerConfigurationException,
                               TransformerFactoryConfigurationError
Transforms an XML Document using XSLT

Parameters:
xmlDocument - the XML Document
xslFile - the XSL Document
Returns:
a String containing the transformed document.
Throws:
TransformerException
TransformerConfigurationException
TransformerFactoryConfigurationError

transform

public static String transform(String xmlDocument,
                               InputStream xsl)
                        throws TransformerException,
                               TransformerConfigurationException,
                               TransformerFactoryConfigurationError
XSL transformation.

Parameters:
xmlDocument - XML document (String)
xsl - XSL document (InputStream)
Returns:
the transformed XML document
Throws:
TransformerException
TransformerConfigurationException
TransformerFactoryConfigurationError

© 2006-2007 ETH Zurich

Copyright © 2007-2010 Global Information Systems Group, ETH Zurich. All Rights Reserved.