Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractBrowse.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractBrowse.java	(revision 26045)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractBrowse.java	(revision 26046)
@@ -23,4 +23,6 @@
 
 import org.apache.log4j.Logger;
+import org.greenstone.gsdl3.util.AbstractBasicDocument;
+import org.greenstone.gsdl3.util.BasicDocument;
 import org.greenstone.gsdl3.util.GSPath;
 import org.greenstone.gsdl3.util.GSXML;
@@ -61,8 +63,13 @@
 	protected static final String INFO_SIB_POS = "siblingPosition";
 
+	protected AbstractBasicDocument gs_doc = null;
+
 	protected Element config_info = null; // the xml from the config file
 
 	protected MacroResolver macro_resolver = null;
 
+	/**
+	 * the default document type - use if all documents are the same type
+	 */
 	protected String default_document_type = null;
 
@@ -175,4 +182,7 @@
 			}
 		}
+
+		// Base line for document (might be overriden by sub-classes)
+		gs_doc = new BasicDocument(this.doc, this.default_document_type);
 
 		return true;
@@ -644,20 +654,5 @@
 	protected Element createDocNode(String node_id)
 	{
-		Element node = this.doc.createElement(GSXML.DOC_NODE_ELEM);
-		node.setAttribute(GSXML.NODE_ID_ATT, node_id);
-
-		String doc_type = null;
-		if (default_document_type != null)
-		{
-			doc_type = default_document_type;
-		}
-		else
-		{
-			doc_type = getDocType(node_id);
-		}
-		node.setAttribute(GSXML.DOC_TYPE_ATT, doc_type);
-		String node_type = getNodeType(node_id, doc_type);
-		node.setAttribute(GSXML.NODE_TYPE_ATT, node_type);
-		return node;
+	  return this.gs_doc.createDocNode(node_id);
 	}
 
@@ -668,23 +663,5 @@
 	protected String getNodeType(String node_id, String doc_type)
 	{
-		if (doc_type.equals(GSXML.DOC_TYPE_SIMPLE))
-		{
-			return GSXML.NODE_TYPE_LEAF;
-		}
-
-		if (getParentId(node_id) == null)
-		{
-			return GSXML.NODE_TYPE_ROOT;
-		}
-		if (doc_type.equals(GSXML.DOC_TYPE_PAGED))
-		{
-			return GSXML.NODE_TYPE_LEAF;
-		}
-		if (getChildrenIds(node_id) == null)
-		{
-			return GSXML.NODE_TYPE_LEAF;
-		}
-		return GSXML.NODE_TYPE_INTERNAL;
-
+	  return this.gs_doc.getNodeType(node_id, doc_type);
 	}
 
@@ -734,5 +711,5 @@
 		parent_node.removeChild(current_node);
 
-		// add in all the siblings,
+		// add in all the siblings,- might be classifier/document nodes
 		addDescendants(parent_node, parent_id, false);
 
@@ -743,4 +720,5 @@
 		Element new_current = GSXML.getNamedElement(parent_node, current_node.getNodeName(), GSXML.NODE_ID_ATT, current_id);
 		return new_current;
+
 	}
 
@@ -758,11 +736,5 @@
 	protected ArrayList<String> getSiblingIds(String node_id)
 	{
-		String parent_id = getParentId(node_id);
-		if (parent_id == null)
-		{
-			return null;
-		}
-		return getChildrenIds(parent_id);
-
+	  return this.gs_doc.getSiblingIds(node_id);
 	}
 
@@ -778,5 +750,7 @@
 	 * GSXML.DOC_TYPE_HIERARCHY
 	 */
-	abstract protected String getDocType(String node_id);
+  protected String getDocType(String node_id) {
+    return this.gs_doc.getDocType(node_id);
+  }
 
 	/**
@@ -784,11 +758,17 @@
 	 * . may be the same as node_id
 	 */
-	abstract protected String getRootId(String node_id);
+  protected String getRootId(String node_id) {
+    return this.gs_doc.getRootId(node_id);
+  }
 
 	/** returns a list of the child ids in order, null if no children */
-	abstract protected ArrayList<String> getChildrenIds(String node_id);
+  protected ArrayList<String> getChildrenIds(String node_id) {
+    return this.gs_doc.getChildrenIds(node_id);
+  }
 
 	/** returns the node id of the parent node, null if no parent */
-	abstract protected String getParentId(String node_id);
+  protected String getParentId(String node_id) {
+    return this.gs_doc.getParentId(node_id);
+  }
 
 	/**
@@ -815,7 +795,9 @@
 	/**
 	 * returns the structural information asked for. info_type may be one of
-	 * INFO_NUM_SIBS, INFO_NUM_CHILDREN, INFO_SIB_POS
-	 */
-	abstract protected String getStructureInfo(String node_id, String info_type);
+	 * INFO_NUM_SIBS, INFO_NUM_CHILDREN, INFO_SIB_POS, INFO_DOC_TYPE
+	 */
+  protected String getStructureInfo(String node_id, String info_type) {
+    return this.gs_doc.getStructureInfo(node_id, info_type);
+  }
 
 }
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractDocumentRetrieve.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractDocumentRetrieve.java	(revision 26045)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractDocumentRetrieve.java	(revision 26046)
@@ -24,4 +24,6 @@
 import org.greenstone.util.GlobalProperties;
 import org.greenstone.gsdl3.core.GSException;
+import org.greenstone.gsdl3.util.AbstractBasicDocument;
+import org.greenstone.gsdl3.util.BasicDocument;
 import org.greenstone.gsdl3.util.GSXML;
 import org.greenstone.gsdl3.util.GSPath;
@@ -67,8 +69,6 @@
 	protected static final String STRUCT_ENTIRE = "entire";
 
-	protected static final String INFO_NUM_SIBS = "numSiblings";
-	protected static final String INFO_NUM_CHILDREN = "numChildren";
-	protected static final String INFO_SIB_POS = "siblingPosition";
-	protected static final String INFO_DOC_TYPE = "documentType";
+
+	protected AbstractBasicDocument gs_doc = null;
 
 	// means the id is not a greenstone id and needs translating
@@ -169,4 +169,7 @@
 			}
 		}
+
+		// Base line for document (might be overriden by sub-classes)
+		gs_doc = new BasicDocument(this.doc, this.default_document_type);
 
 		return true;
@@ -631,20 +634,5 @@
 	protected Element createDocNode(String node_id)
 	{
-		Element node = this.doc.createElement(GSXML.DOC_NODE_ELEM);
-		node.setAttribute(GSXML.NODE_ID_ATT, node_id);
-
-		String doc_type = null;
-		if (default_document_type != null)
-		{
-			doc_type = default_document_type;
-		}
-		else
-		{
-			doc_type = getDocType(node_id);
-		}
-		node.setAttribute(GSXML.DOC_TYPE_ATT, doc_type);
-		String node_type = getNodeType(node_id, doc_type);
-		node.setAttribute(GSXML.NODE_TYPE_ATT, node_type);
-		return node;
+		return this.gs_doc.createDocNode(node_id);
 	}
 
@@ -655,17 +643,5 @@
 	protected void addDescendants(Element doc, String doc_id, boolean recursive)
 	{
-		ArrayList<String> child_ids = getChildrenIds(doc_id);
-		if (child_ids == null)
-			return;
-		for (int i = 0; i < child_ids.size(); i++)
-		{
-			String child_id = child_ids.get(i);
-			Element child_elem = createDocNode(child_id);
-			doc.appendChild(child_elem);
-			if (recursive && (!child_elem.getAttribute(GSXML.NODE_TYPE_ATT).equals(GSXML.NODE_TYPE_LEAF) || child_elem.getAttribute(GSXML.DOC_TYPE_ATT).equals(GSXML.DOC_TYPE_PAGED)))
-			{
-				addDescendants(child_elem, child_id, recursive);
-			}
-		}
+	  this.gs_doc.addDescendants(doc, doc_id, recursive);
 	}
 
@@ -676,23 +652,5 @@
 	protected Element addSiblings(Element parent_node, String parent_id, String current_id)
 	{
-		Element current_node = GSXML.getFirstElementChild(parent_node);//(Element)parent_node.getFirstChild();
-		if (current_node == null)
-		{
-			// create a sensible error message
-			logger.error(" there should be a first child.");
-			return null;
-		}
-		// remove the current child,- will add it in later in its correct place
-		parent_node.removeChild(current_node);
-
-		// add in all the siblings,
-		addDescendants(parent_node, parent_id, false);
-
-		// find the node that is now the current node
-		// this assumes that the new node that was created is the same as 
-		// the old one that was removed - we may want to replace the new one 
-		// with the old one.
-		Element new_current = GSXML.getNamedElement(parent_node, current_node.getNodeName(), GSXML.NODE_ID_ATT, current_id);
-		return new_current;
+	  return this.gs_doc.addSiblings(parent_node, parent_id, current_id);
 	}
 
@@ -725,28 +683,10 @@
 	protected String getNodeType(String node_id, String doc_type)
 	{
-		if (doc_type.equals(GSXML.DOC_TYPE_SIMPLE))
-		{
-			return GSXML.NODE_TYPE_LEAF;
-		}
-
-		if (getParentId(node_id) == null)
-		{
-			return GSXML.NODE_TYPE_ROOT;
-		}
-		if (doc_type.equals(GSXML.DOC_TYPE_PAGED))
-		{
-			return GSXML.NODE_TYPE_LEAF;
-		}
-		if (getChildrenIds(node_id) == null)
-		{
-			return GSXML.NODE_TYPE_LEAF;
-		}
-		return GSXML.NODE_TYPE_INTERNAL;
-
-	}
-
-	/**
-	 * if id ends in .fc, .pc etc, then translate it to the correct id default
-	 * implementation: just remove the suffix
+	return this.gs_doc.getNodeType(node_id, doc_type);
+	}
+
+	/**
+	 * if id ends in .fc, .pc etc, then translate it to the correct id 
+	 * default implementation: just remove the suffix
 	 */
 	protected String translateId(String id)
@@ -784,36 +724,34 @@
 	 * returns the document type of the doc that the specified node belongs to.
 	 * should be one of GSXML.DOC_TYPE_SIMPLE, GSXML.DOC_TYPE_PAGED,
-	 * GSXML.DOC_TYPE_HIERARCHY default implementation: return DOC_TYPE_SIMPLE
+	 * GSXML.DOC_TYPE_HIERARCHY
 	 */
 	protected String getDocType(String node_id)
 	{
-		return GSXML.DOC_TYPE_HIERARCHY;
+		return this.gs_doc.getDocType(node_id);
 	}
 
 	/**
 	 * returns the id of the root node of the document containing node node_id.
-	 * may be the same as node_id default implemntation: return node_id
+	 * may be the same as node_id 
 	 */
 	protected String getRootId(String node_id)
 	{
-		return node_id;
-	}
-
-	/**
-	 * returns a list of the child ids in order, null if no children default
-	 * implementation: return null
+		return  this.gs_doc.getRootId(node_id);
+	}
+
+	/**
+	 * returns a list of the child ids in order, null if no children 
 	 */
 	protected ArrayList<String> getChildrenIds(String node_id)
 	{
-		return null;
-	}
-
-	/**
-	 * returns the node id of the parent node, null if no parent default
-	 * implementation: return null
+	  return this.gs_doc.getChildrenIds(node_id);
+	}
+
+	/**
+	 * returns the node id of the parent node, null if no parent 
 	 */
 	protected String getParentId(String node_id)
 	{
-		return null;
+	  return this.gs_doc.getParentId(node_id);
 	}
 
@@ -834,10 +772,9 @@
 	 * INFO_NUM_SIBS, INFO_NUM_CHILDREN, INFO_SIB_POS
 	 */
-	abstract protected String getStructureInfo(String doc_id, String info_type);
-
-	protected String getHrefOID(String href_url)
-	{
-		return null;
-	}
+  protected String getStructureInfo(String doc_id, String info_type) {
+
+    return this.gs_doc.getStructureInfo(doc_id, info_type);
+  }
+
 
 }
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java	(revision 26045)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2DocumentRetrieve.java	(revision 26046)
@@ -21,4 +21,5 @@
 // Greenstone classes
 import org.greenstone.gsdl3.core.GSException;
+import org.greenstone.gsdl3.util.BasicDocumentDatabase;
 import org.greenstone.gsdl3.util.GSXML;
 import org.greenstone.gsdl3.util.GSFile;
@@ -63,5 +64,5 @@
 
 	protected SimpleCollectionDatabase coll_db = null;
-
+  BasicDocumentDatabase gs_doc_db = null;
 	/** constructor */
 	protected AbstractGS2DocumentRetrieve()
@@ -74,4 +75,5 @@
 		super.cleanUp();
 		this.coll_db.closeDatabase();
+		this.gs_doc_db.cleanUp();
 	}
 
@@ -124,4 +126,12 @@
 			return false;
 		}
+
+		gs_doc_db = new BasicDocumentDatabase(this.doc, database_type, this.site_home, this.cluster_name, this.index_stem);
+		if (!gs_doc_db.isValid())
+		{
+			logger.error("Failed to open Document Database.");
+			return false;
+		}
+		this.gs_doc = gs_doc_db;
 
 		// we need to set the database for our GS2 macro resolver
@@ -153,42 +163,8 @@
 	protected String getRootId(String node_id)
 	{
-		return OID.getTop(node_id);
-	}
-
-	/** returns a list of the child ids in order, null if no children */
-	protected ArrayList<String> getChildrenIds(String node_id)
-	{
-		DBInfo info = this.coll_db.getInfo(node_id);
-		if (info == null)
-		{
-			return null;
-		}
-
-		String contains = info.getInfo("contains");
-		if (contains.equals(""))
-		{
-			return null;
-		}
-		ArrayList<String> children = new ArrayList<String>();
-		StringTokenizer st = new StringTokenizer(contains, ";");
-		while (st.hasMoreTokens())
-		{
-			String child_id = StringUtils.replace(st.nextToken(), "\"", node_id);
-			children.add(child_id);
-		}
-		return children;
-
-	}
-
-	/** returns the node id of the parent node, null if no parent */
-	protected String getParentId(String node_id)
-	{
-		String parent = OID.getParent(node_id);
-		if (parent.equals(node_id))
-		{
-			return null;
-		}
-		return parent;
-	}
+	  return this.gs_doc.getRootId(node_id);
+	}
+
+
 
 	/**
@@ -236,133 +212,10 @@
 	}
 
-	/**
-	 * returns the structural information asked for. info_type may be one of
-	 * INFO_NUM_SIBS, INFO_NUM_CHILDREN, INFO_SIB_POS
-	 */
-	protected String getStructureInfo(String doc_id, String info_type)
-	{
-		String value = "";
-		if (info_type.equals(INFO_NUM_SIBS))
-		{
-			String parent_id = OID.getParent(doc_id);
-			if (parent_id.equals(doc_id))
-			{
-				value = "0";
-			}
-			else
-			{
-				value = String.valueOf(getNumChildren(parent_id));
-			}
-			return value;
-		}
-
-		if (info_type.equals(INFO_NUM_CHILDREN))
-		{
-			return String.valueOf(getNumChildren(doc_id));
-		}
-
-		if (info_type.equals(INFO_SIB_POS))
-		{
-			String parent_id = OID.getParent(doc_id);
-			if (parent_id.equals(doc_id))
-			{
-				return "-1";
-			}
-
-			DBInfo info = this.coll_db.getInfo(parent_id);
-			if (info == null)
-			{
-				return "-1";
-			}
-
-			String contains = info.getInfo("contains");
-			contains = StringUtils.replace(contains, "\"", parent_id);
-			String[] children = contains.split(";");
-			for (int i = 0; i < children.length; i++)
-			{
-				String child_id = children[i];
-				if (child_id.equals(doc_id))
-				{
-					return String.valueOf(i + 1); // make it from 1 to length
-
-				}
-			}
-
-			return "-1";
-		}
-		if (info_type.equals(INFO_DOC_TYPE))
-	
-		{
-		  return getDocType(doc_id);
-		}
-		return null;
-	}
 
 	protected int getNumChildren(String node_id)
 	{
-		DBInfo info = this.coll_db.getInfo(node_id);
-		if (info == null)
-		{
-			return 0;
-		}
-		String contains = info.getInfo("contains");
-		if (contains.equals(""))
-		{
-			return 0;
-		}
-		String[] children = contains.split(";");
-		return children.length;
-	}
-
-	/**
-	 * returns the document type of the doc that the specified node belongs to.
-	 * should be one of GSXML.DOC_TYPE_SIMPLE, GSXML.DOC_TYPE_PAGED,
-	 * GSXML.DOC_TYPE_HIERARCHY
-	 */
-	protected String getDocType(String node_id)
-	{
-		DBInfo info = this.coll_db.getInfo(node_id);
-		if (info == null)
-		{
-			return GSXML.DOC_TYPE_SIMPLE;
-		}
-		String doc_type = info.getInfo("doctype");
-		if (!doc_type.equals("") && !doc_type.equals("doc"))
-		{
-			return doc_type;
-		}
-
-		String top_id = OID.getTop(node_id);
-		boolean is_top = (top_id.equals(node_id) ? true : false);
-
-		String children = info.getInfo("contains");
-		boolean is_leaf = (children.equals("") ? true : false);
-
-		if (is_top && is_leaf)
-		{ // a single section document
-			return GSXML.DOC_TYPE_SIMPLE;
-		}
-
-		// now we just check the top node
-		if (!is_top)
-		{ // we need to look at the top info
-			info = this.coll_db.getInfo(top_id);
-		}
-		if (info == null)
-		{
-			return GSXML.DOC_TYPE_HIERARCHY;
-		}
-
-		String childtype = info.getInfo("childtype");
-		if (childtype.equals("Paged"))
-		{
-			return GSXML.DOC_TYPE_PAGED;
-		}
-		if (childtype.equals("PagedHierarchy"))
-		  {
-		    return GSXML.DOC_TYPE_PAGED_HIERARCHY;
-		  }
-		return GSXML.DOC_TYPE_HIERARCHY;
-	}
+	  return this.gs_doc.getNumChildren(node_id);
+	}
+
 
 	/**
@@ -591,69 +444,5 @@
 	}
 
-	protected Element getInfo(String doc_id, String info_type)
-	{
-
-		String value = "";
-		if (info_type.equals(INFO_NUM_SIBS))
-		{
-			String parent_id = OID.getParent(doc_id);
-			if (parent_id.equals(doc_id))
-			{
-				value = "0";
-			}
-			else
-			{
-				value = String.valueOf(getNumChildren(parent_id));
-			}
-		}
-		else if (info_type.equals(INFO_NUM_CHILDREN))
-		{
-			value = String.valueOf(getNumChildren(doc_id));
-		}
-		else if (info_type.equals(INFO_SIB_POS))
-		{
-			String parent_id = OID.getParent(doc_id);
-			if (parent_id.equals(doc_id))
-			{
-				value = "-1";
-			}
-			else
-			{
-				DBInfo info = this.coll_db.getInfo(parent_id);
-				if (info == null)
-				{
-					value = "-1";
-				}
-				else
-				{
-					String contains = info.getInfo("contains");
-					contains = StringUtils.replace(contains, "\"", parent_id);
-					String[] children = contains.split(";");
-					for (int i = 0; i < children.length; i++)
-					{
-						String child_id = children[i];
-						if (child_id.equals(doc_id))
-						{
-							value = String.valueOf(i + 1); // make it from 1 to length
-							break;
-						}
-					}
-				}
-			}
-		}
-		else
-		{
-			return null;
-		}
-		Element info_elem = this.doc.createElement("info");
-		info_elem.setAttribute(GSXML.NAME_ATT, info_type);
-		info_elem.setAttribute(GSXML.VALUE_ATT, value);
-		return info_elem;
-	}
-
-	protected String getHrefOID(String href_url)
-	{
-		return this.coll_db.docnum2OID(href_url);
-	}
+
 
 }
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2TextSearch.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2TextSearch.java	(revision 26045)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/AbstractGS2TextSearch.java	(revision 26046)
@@ -18,5 +18,4 @@
 package org.greenstone.gsdl3.service;
 
-// Greenstone classes
 import java.util.ArrayList;
 
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Browse.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Browse.java	(revision 26045)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/service/GS2Browse.java	(revision 26046)
@@ -26,4 +26,5 @@
 
 import org.apache.log4j.Logger;
+import org.greenstone.gsdl3.util.BasicDocumentDatabase;
 import org.greenstone.gsdl3.util.DBInfo;
 import org.greenstone.gsdl3.util.GS2MacroResolver;
@@ -45,5 +46,5 @@
 
 	protected SimpleCollectionDatabase coll_db = null;
-
+  BasicDocumentDatabase gs_doc_db = null;
 	public GS2Browse()
 	{
@@ -54,4 +55,5 @@
 		super.cleanUp();
 		this.coll_db.closeDatabase();
+		this.gs_doc_db.cleanUp();
 	}
 
@@ -88,4 +90,6 @@
 			database_type = "gdbm"; // the default
 		}
+
+		// do we still need this????
 		coll_db = new SimpleCollectionDatabase(database_type);
 		if (!coll_db.databaseOK())
@@ -103,4 +107,14 @@
 		}
 		this.macro_resolver = new GS2MacroResolver(this.coll_db);
+		
+		gs_doc_db = new BasicDocumentDatabase(this.doc, database_type, this.site_home, this.cluster_name, index_stem);
+		if (!gs_doc_db.isValid())
+		{
+			logger.error("Failed to open Document Database.");
+			return false;
+		}
+		this.gs_doc = gs_doc_db;
+
+	
 		return true;
 	}
@@ -122,97 +136,6 @@
 	}
 
-	/**
-	 * returns the document type of the doc that the specified node belongs to.
-	 * should be one of GSXML.DOC_TYPE_SIMPLE, GSXML.DOC_TYPE_PAGED,
-	 * GSXML.DOC_TYPE_HIERARCHY
-	 */
-	protected String getDocType(String node_id)
-	{
-		DBInfo info = this.coll_db.getInfo(node_id);
-		if (info == null)
-		{
-			return GSXML.DOC_TYPE_SIMPLE;
-		}
-		String doc_type = info.getInfo("doctype");
-		if (!doc_type.equals("") && !doc_type.equals("doc"))
-		{
-			return doc_type;
-		}
-
-		String top_id = OID.getTop(node_id);
-		boolean is_top = (top_id.equals(node_id) ? true : false);
-
-		String children = info.getInfo("contains");
-		boolean is_leaf = (children.equals("") ? true : false);
-
-		if (is_top && is_leaf)
-		{ // a single section document
-			return GSXML.DOC_TYPE_SIMPLE;
-		}
-
-		// now we just check the top node
-		if (!is_top)
-		{ // we need to look at the top info
-			info = this.coll_db.getInfo(top_id);
-		}
-		if (info == null)
-		{
-			return GSXML.DOC_TYPE_HIERARCHY;
-		}
-
-		String childtype = info.getInfo("childtype");
-		if (childtype.equals("Paged"))
-		{
-			return GSXML.DOC_TYPE_PAGED;
-		}
-		if (childtype.equals("PagedHierarchy"))
-		  {
-		    return GSXML.DOC_TYPE_PAGED_HIERARCHY;
-		  }
-		return GSXML.DOC_TYPE_HIERARCHY;
-
-	}
-
-	/**
-	 * returns the id of the root node of the document containing node node_id.
-	 * . may be the same as node_id
-	 */
-	protected String getRootId(String node_id)
-	{
-		return OID.getTop(node_id);
-	}
-
-	/** returns a list of the child ids in order, null if no children */
-	protected ArrayList<String> getChildrenIds(String node_id)
-	{
-		DBInfo info = this.coll_db.getInfo(node_id);
-		if (info == null)
-		{
-			return null;
-		}
-
-		ArrayList<String> children = new ArrayList<String>();
-
-		String contains = info.getInfo("contains");
-		StringTokenizer st = new StringTokenizer(contains, ";");
-		while (st.hasMoreTokens())
-		{
-			String child_id = st.nextToken().replaceAll("\"", node_id);
-			children.add(child_id);
-		}
-		return children;
-
-	}
-
-	/** returns the node id of the parent node, null if no parent */
-	protected String getParentId(String node_id)
-	{
-		String parent = OID.getParent(node_id);
-		if (parent.equals(node_id))
-		{
-			return null;
-		}
-		return parent;
-	}
+
+
 
 	protected String getMetadata(String node_id, String key)
@@ -281,80 +204,8 @@
 	}
 
-	/**
-	 * returns the structural information asked for. info_type may be one of
-	 * INFO_NUM_SIBS, INFO_NUM_CHILDREN, INFO_SIB_POS
-	 */
-	protected String getStructureInfo(String doc_id, String info_type)
-	{
-		String value = "";
-		if (info_type.equals(INFO_NUM_SIBS))
-		{
-			String parent_id = OID.getParent(doc_id);
-			if (parent_id.equals(doc_id))
-			{
-				value = "0";
-			}
-			else
-			{
-				value = String.valueOf(getNumChildren(parent_id));
-			}
-			return value;
-		}
-
-		if (info_type.equals(INFO_NUM_CHILDREN))
-		{
-			return String.valueOf(getNumChildren(doc_id));
-		}
-
-		if (info_type.equals(INFO_SIB_POS))
-		{
-			String parent_id = OID.getParent(doc_id);
-			if (parent_id.equals(doc_id))
-			{
-				return "-1";
-			}
-
-			DBInfo info = this.coll_db.getInfo(parent_id);
-			if (info == null)
-			{
-				return "-1";
-			}
-
-			String contains = info.getInfo("contains");
-			contains = contains.replaceAll("\"", parent_id);
-			String[] children = contains.split(";");
-			for (int i = 0; i < children.length; i++)
-			{
-				String child_id = children[i];
-				if (child_id.equals(doc_id))
-				{
-					return String.valueOf(i + 1); // make it from 1 to length
-
-				}
-			}
-
-			return "-1";
-		}
-		else
-		{
-			return null;
-		}
-
-	}
 
 	protected int getNumChildren(String node_id)
 	{
-		DBInfo info = this.coll_db.getInfo(node_id);
-		if (info == null)
-		{
-			return 0;
-		}
-		String contains = info.getInfo("contains");
-		if (contains.equals(""))
-		{
-			return 0;
-		}
-		String[] children = contains.split(";");
-		return children.length;
+	  return this.gs_doc.getNumChildren(node_id);
 	}
 
