tom.library.xml
Class XmlTools

java.lang.Object
  extended by tom.library.xml.XmlTools

public class XmlTools
extends Object


Constructor Summary
XmlTools()
           
 
Method Summary
 Node convertToNode(InputStream is)
          Converts XML to Node by providing an InputStream
 TNode convertXMLToTNode(InputStream is)
          Converts XML to TNode by providing an input stream
 TNode convertXMLToTNode(String filename)
          Converts XML to TNode
 Collection getNodes(TNode n)
          Returns all TNodes contained in TNode n
 TNodeList nodeListToAterm(NodeList n)
          Returns an ATerm representation of a NodeList
 TNode nodeToTNode(Node node)
          Returns a TNode by providing a Node
 void printXMLFromTNode(TNode t)
          Prints TNode t in XML format, without any extra character (ie:\n)
 void setDeletingWhiteSpaceNodes(boolean b_d)
          Set up the deleteWhiteSpaceNodes variable
 Node tttttttttttt(String filename)
          Converts XML to Node by providing a file name
 void writeXMLFileFromTNode(Writer writer, TNode t)
          Writes TNode in XML format, without any extra character (ie:\n)
 String xml(TNode t)
          Constructs TNode in XML
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XmlTools

public XmlTools()
Method Detail

setDeletingWhiteSpaceNodes

public void setDeletingWhiteSpaceNodes(boolean b_d)
Set up the deleteWhiteSpaceNodes variable

Parameters:
b_d - a boolean which allows to define if white space nodes have to be deleted or not

nodeToTNode

public TNode nodeToTNode(Node node)
Returns a TNode by providing a Node

Parameters:
node - the Node to normalize and convert
Returns:
a TNode obtained from the Node

nodeListToAterm

public TNodeList nodeListToAterm(NodeList n)
Returns an ATerm representation of a NodeList

Parameters:
n - the NodeList
Returns:
an ATerm representation of the NodeList

tttttttttttt

public Node tttttttttttt(String filename)
Converts XML to Node by providing a file name

Parameters:
filename - the filename
Returns:
the Node representation of the XML file

convertToNode

public Node convertToNode(InputStream is)
Converts XML to Node by providing an InputStream

Parameters:
is - the InputStream
Returns:
the Node representation of XML

getNodes

public Collection getNodes(TNode n)
Returns all TNodes contained in TNode n

Parameters:
n - root to collect all TNodes in the tree
Returns:
a collection of TNode contained in TNode n

convertXMLToTNode

public TNode convertXMLToTNode(String filename)
Converts XML to TNode

Parameters:
filename - input representing XML
Returns:
a TNode representation of XML

convertXMLToTNode

public TNode convertXMLToTNode(InputStream is)
Converts XML to TNode by providing an input stream

Parameters:
is - input representing XML
Returns:
a TNode representation of XML

printXMLFromTNode

public void printXMLFromTNode(TNode t)
Prints TNode t in XML format, without any extra character (ie:\n)

Parameters:
t - TNode to print

writeXMLFileFromTNode

public void writeXMLFileFromTNode(Writer writer,
                                  TNode t)
Writes TNode in XML format, without any extra character (ie:\n)

Parameters:
writer - the provided writer
t - TNode to XML
See Also:
TNode

xml

public String xml(TNode t)
Constructs TNode in XML

Parameters:
t - this parameter can be either a TNode, a TNode list, or #TEXT("...").
Returns:
a string representation of XML