org.jmat.io.files
Class XMLFile

java.lang.Object
  |
  +--org.jmat.io.files.DataFile
        |
        +--org.jmat.io.files.XMLFile

public class XMLFile
extends DataFile

Copyright : LGPL


Field Summary
 
Fields inherited from class org.jmat.io.files.DataFile
file
 
Constructor Summary
XMLFile(java.io.File f)
           
 
Method Summary
 org.jdom.Element getElement(org.jdom.Element root, java.lang.String elementsName, java.lang.String[] attributesNames, java.lang.String[] attributesValues)
           
 org.jdom.Element getElement(java.lang.String elementsName, java.lang.String[] attributesNames, java.lang.String[] attributesValues)
           
static void main(java.lang.String[] args)
           
 org.jdom.Element read()
          Reaed an XML Element from an XML File
 java.lang.String readAttributeValue(java.lang.String attributeName, java.lang.String[] elementsNames, java.lang.String[][] attributesNames, java.lang.String[][] attributesValues)
          Read attribute value of the specified XML path
 java.lang.String[] readAttributeValues(java.lang.String attributeName, java.lang.String[] elementsNames, java.lang.String[][] attributesNames, java.lang.String[][] attributesValues)
          Read attributes values of the specified XML path
static java.lang.String readContent(java.io.File f, java.lang.String[] elementsNames, java.lang.String[][] attributesNames, java.lang.String[][] attributesValues)
           
 java.lang.String readContent(java.lang.String[] elementsNames)
          Read a String data with the specified position
 java.lang.String readContent(java.lang.String[] elementsNames, int[] subElementsIndexes)
          Read a String data with the specified position
 java.lang.String readContent(java.lang.String[] elementsNames, java.lang.String[][] attributesNames, java.lang.String[][] attributesValues)
          Read String data with the specified XML path
static java.lang.String[] readContents(java.io.File f, java.lang.String[] elementsNames, java.lang.String[][] attributesNames, java.lang.String[][] attributesValues)
           
 java.lang.String[] readContents(java.lang.String[] elementsNames, java.lang.String[][] attributesNames, java.lang.String[][] attributesValues)
          Read String datas with the specified XML path
static org.jdom.Element readRoot(java.io.File f)
           
 void write(org.jdom.Element e)
          Write the root Element in the XML file
 void write(java.lang.String elementName, java.lang.String[] attributesNames, java.lang.String[] attributesValues)
          Write an Element as root in the XML file
static void writeRoot(java.io.File f, org.jdom.Element e)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

XMLFile

public XMLFile(java.io.File f)
Method Detail

readRoot

public static org.jdom.Element readRoot(java.io.File f)

readContents

public static java.lang.String[] readContents(java.io.File f,
                                              java.lang.String[] elementsNames,
                                              java.lang.String[][] attributesNames,
                                              java.lang.String[][] attributesValues)

readContent

public static java.lang.String readContent(java.io.File f,
                                           java.lang.String[] elementsNames,
                                           java.lang.String[][] attributesNames,
                                           java.lang.String[][] attributesValues)

writeRoot

public static void writeRoot(java.io.File f,
                             org.jdom.Element e)

read

public org.jdom.Element read()
Reaed an XML Element from an XML File

Returns:
JDOM Element

readAttributeValue

public java.lang.String readAttributeValue(java.lang.String attributeName,
                                           java.lang.String[] elementsNames,
                                           java.lang.String[][] attributesNames,
                                           java.lang.String[][] attributesValues)
Read attribute value of the specified XML path

Parameters:
attributeName - last attribute name containing the searched value
elementsNames - Path of elements leading to the data searched
attributesNames - Attributes of each element
attributesValues - Attributes values of each element
Returns:
String of attributes values

readAttributeValues

public java.lang.String[] readAttributeValues(java.lang.String attributeName,
                                              java.lang.String[] elementsNames,
                                              java.lang.String[][] attributesNames,
                                              java.lang.String[][] attributesValues)
Read attributes values of the specified XML path

Parameters:
attributeName - last attribute name containing the searched value
elementsNames - Path of elements leading to the data searched
attributesNames - Attributes of each element
attributesValues - Attributes values of each element
Returns:
String[] of attributes values

readContent

public java.lang.String readContent(java.lang.String[] elementsNames,
                                    java.lang.String[][] attributesNames,
                                    java.lang.String[][] attributesValues)
Read String data with the specified XML path

Parameters:
elementsNames - Path of elements leading to the data searched
attributesNames - Attributes of each element
attributesValues - Attributes values of each element
Returns:
String data

readContents

public java.lang.String[] readContents(java.lang.String[] elementsNames,
                                       java.lang.String[][] attributesNames,
                                       java.lang.String[][] attributesValues)
Read String datas with the specified XML path

Parameters:
elementsNames - Path of elements leading to the datas searched
attributesNames - Attributes of each element
attributesValues - Attributes values of each element
Returns:
String[] datas

readContent

public java.lang.String readContent(java.lang.String[] elementsNames)
Read a String data with the specified position

Parameters:
elementsNames - Path of elements leading to the data wanted (the first children element matching is used if many are found !)
Returns:
String data found

readContent

public java.lang.String readContent(java.lang.String[] elementsNames,
                                    int[] subElementsIndexes)
Read a String data with the specified position

Parameters:
elementsNames - Path of elements leading to the data wanted.
subElementsIndexes - index of children Element used for each parent Element (Maybe 0)
Returns:
String data found

write

public void write(java.lang.String elementName,
                  java.lang.String[] attributesNames,
                  java.lang.String[] attributesValues)
Write an Element as root in the XML file

Parameters:
elementName - name of the root element to create
attributesNames - attributes of the element
attributesValues - attributes values of the element

write

public void write(org.jdom.Element e)
Write the root Element in the XML file

Parameters:
e - Element to write

getElement

public org.jdom.Element getElement(org.jdom.Element root,
                                   java.lang.String elementsName,
                                   java.lang.String[] attributesNames,
                                   java.lang.String[] attributesValues)

getElement

public org.jdom.Element getElement(java.lang.String elementsName,
                                   java.lang.String[] attributesNames,
                                   java.lang.String[] attributesValues)

main

public static void main(java.lang.String[] args)