Index: trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AbstractHierarchyNode.java
===================================================================
--- trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AbstractHierarchyNode.java	(revision 6350)
+++ trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/AbstractHierarchyNode.java	(revision 6351)
@@ -59,4 +59,5 @@
     child.setParent(this);
 
+    /*
     if (this.id == null) {
       System.out.println(child.id.toString() + " added to root");
@@ -65,4 +66,5 @@
       System.out.println(child.id.toString() + " added to " + this.id);
     }
+    */
   }
 
Index: trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/GS2HierarchyClassifier.java
===================================================================
--- trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/GS2HierarchyClassifier.java	(revision 6350)
+++ trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/GS2HierarchyClassifier.java	(revision 6351)
@@ -157,5 +157,5 @@
     this.hierarchy = handler.getHierarchy();
     this.fields = new ArrayList();
-    System.out.println("loaded hierarchy for "+ file.toString());
+    //    System.out.println("loaded hierarchy for "+ file.toString());
     this.database = null;
   }
@@ -246,5 +246,5 @@
       }
 
-      System.out.println("Matching " + values.get(0).toString());
+      //      System.out.println("Matching " + values.get(0).toString());
 
       if (documentID == null) {
Index: trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/HierarchyClassifier.java
===================================================================
--- trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/HierarchyClassifier.java	(revision 6350)
+++ trunk/gsdl3/src/java/org/greenstone/gsdl3/gs3build/classifier/HierarchyClassifier.java	(revision 6351)
@@ -40,8 +40,8 @@
   class HierarchyNode
   { String descriptor;    // the textual descriptor used on screen or long-hand
-    String name;          // the index number, letter assignment or other item
+    String path;          // the index number, letter assignment or other item
                           //   used to identify the position of the item in the
                           //   hierarchy
-    String id;            // an identifier used by the GLI for maintenance
+    String name;          // an identifier used by the GLI for maintenance
                           //   purposes; this plays no active role in the
                           //   rebuilding process (at the moment)
@@ -58,5 +58,5 @@
     { this.descriptor = null;
       this.name       = null;
-      this.id         = null;
+      this.path       = null;
       this.childNodes = new ArrayList();
       this.childDocs  = new ArrayList();
@@ -85,6 +85,6 @@
     }
 
-    public void setID(String id)
-    { this.id = id;
+    public void setPath(String path)
+    { this.path = path;
     }
 
@@ -134,9 +134,10 @@
   { StringBuffer description;
     StringBuffer name;
-    StringBuffer id;
+    StringBuffer path;
     StringBuffer match;
     boolean inElement;
     HierarchyNode rootNode = null;
     HierarchyNode currentNode = null;
+    List          rootNodes = null;
 
     HierarchyHandler()
@@ -145,6 +146,7 @@
       this.name        = null;
       this.description = null;
-      this.id          = null;
+      this.path        = null;
       this.match       = null;
+      this.rootNodes   = new ArrayList();
     }
 
@@ -155,15 +157,6 @@
 
 	// Initialise the tree
-	if (currentNode == null)
-	{ if (this.rootNode == null) // which it should be
-	  { this.rootNode = node;
-	  }
-	  else // insert a new root node, and set this as the peer
-	       // of the original root...
-	  { HierarchyNode newRoot = new HierarchyNode();
-	    newRoot.addChild(this.rootNode);
-	    newRoot.addChild(node);
-	    this.rootNode = newRoot;
-	  }
+	if (this.currentNode == null)
+	{ this.rootNode = node;
 	}
         // Add the node
@@ -176,6 +169,6 @@
       {	this.name = new StringBuffer();
       }
-      else if (localName.equals("ID"))
-      {	this.id   = new StringBuffer();
+      else if (localName.equals("Path"))
+      {	this.path   = new StringBuffer();
       }
       else if (localName.equals("Description"))
@@ -192,5 +185,8 @@
     public void endElement(String URI, String localName, String qName)
     { if (localName.equals("Classification"))
-      {	this.currentNode = this.currentNode.getParent();
+      {	if (this.currentNode.getParent() == null) {
+          this.rootNodes.add(this.currentNode);
+        }
+	this.currentNode = this.currentNode.getParent();
       }
       else if (localName.equals("Name"))
@@ -198,7 +194,7 @@
         this.name = null;
       }
-      else if (localName.equals("ID"))
-      {	this.currentNode.setID(XMLTools.cleanString(this.id.toString()));
-        this.id = null;
+      else if (localName.equals("Path"))
+      {	this.currentNode.setPath(XMLTools.cleanString(this.path.toString()));
+        this.path = null;
       }
       else if (localName.equals("Description"))
@@ -217,6 +213,6 @@
     public void characters(char c[], int start, int length)
     { String string = new String(c, start, length);
-      if (this.id != null)
-      { this.id.append(string);
+      if (this.path != null)
+      { this.path.append(string);
       }
       else if (this.name != null)
@@ -238,6 +234,7 @@
   private HierarchyNode hierarchy;
   private List          fields;
-
-  public HierarchyClassifier(File basefile, List fields)
+  private String        sort;
+
+  public HierarchyClassifier(File basefile, List fields, String sort)
   {	
     try 
@@ -253,4 +250,5 @@
       this.hierarchy = handler.getHierarchy();
       this.fields = fields;
+      this.sort   = sort;
     }
     catch (SAXException saxException)
