public static void main(String[] args) throws FileAccessException {
final long time = System.currentTimeMillis();
final String filename = args[0];
// Instantiate Dataset (Gumtree meaning) on file to be read
Dataset dataset = Factory.getDataset(new File(filename).toURI());
// Get the file root
Group group = dataset.getRootGroup();
// generate the file's dictionary starting from the file's root
Map<String, String> dictionary = createDictionary(group);
// Instantiate the dictionary
IPathResolver pathResolver = new DictionaryPathResolver(dictionary);
// Instantiation the "container" that links the dataset and the dictionary
IDataContainer container = new DataContainer(dataset);
// Set dictionary on the container
container.setPathSolver(pathResolver);
// Parse the file (using the dictionary) to display data
for (String key : dictionary.keySet())
{
String value;
try
{
// get the value of the dataset corresponding to the current key
value = container.get(key).toString();
System.out.println(key + ": " + (value.length() < 1000 ? value : "Data to long to be displayed using eclipse!") );
}
catch(DataModelException n)
{
System.out.println("ERROR on key: " + key);
n.printStackTrace();
}
// Get the group node corresponding to the current key
group = dataset.getRootGroup();
DataItem toto = (DataItem) group.getObjectByPath(container.getPathResolver()
.resolvePath(key));
group = toto.getParentGroup();
// Scan node's attribute