Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/AbstractBasicDocument.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/AbstractBasicDocument.java	(revision 28964)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/AbstractBasicDocument.java	(revision 28965)
@@ -34,11 +34,10 @@
 
     /** XML element for describe requests - the container doc */
-    protected Document doc = null; // typically a shared reference to the one in ServiceRack
+    //protected Document doc = null; // typically a shared reference to the one in ServiceRack
 
     static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.AbstractBasicDocument.class.getName());
 
-    public AbstractBasicDocument(Document doc) 
+    public AbstractBasicDocument() 
     {
-	this.doc = doc;
     }
 
@@ -47,6 +46,6 @@
      * <docNode nodeId='xxx' nodeType='leaf' docType='hierarchy'/>
      */
-  public Element createDocNode(String node_id) {
-    return createDocNode(node_id, null);
+  public Element createDocNode(Document doc, String node_id) {
+    return createDocNode(doc, node_id, null);
   }
     /** create an element to go into a results list. A node element
@@ -54,6 +53,6 @@
      * <docNode nodeId='xxx' nodeType='leaf' docType='hierarchy' [rank='0.23']/>
      */
-    public Element createDocNode(String node_id, String rank) {
-	Element node = this.doc.createElement(GSXML.DOC_NODE_ELEM);
+  public Element createDocNode(Document doc, String node_id, String rank) {
+	Element node = doc.createElement(GSXML.DOC_NODE_ELEM);
 	node.setAttribute(GSXML.NODE_ID_ATT, node_id);
 	if (rank != null) {
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocument.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocument.java	(revision 28964)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocument.java	(revision 28965)
@@ -34,7 +34,7 @@
     static Logger logger = Logger.getLogger(org.greenstone.gsdl3.util.BasicDocument.class.getName());
 
-    public BasicDocument(Document doc, String default_document_type)
+  public BasicDocument(String default_document_type)
     {
-	super(doc);
+	super();
 
 	this.default_document_type = default_document_type;
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocumentDatabase.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocumentDatabase.java	(revision 28964)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/BasicDocumentDatabase.java	(revision 28965)
@@ -52,9 +52,8 @@
 
     /** constructor */
-    public BasicDocumentDatabase(Document doc, 
-				  String database_type, String site_home,
+    public BasicDocumentDatabase(String database_type, String site_home,
 				  String cluster_name,  String index_stem)
     {
-	super(doc);
+	super();
 
 	coll_db = new SimpleCollectionDatabase(database_type);
@@ -130,8 +129,8 @@
 	    return GSXML.DOC_TYPE_PAGED;
 	}
-		if (childtype.equals("PagedHierarchy"))
-		  {
-		    return GSXML.DOC_TYPE_PAGED_HIERARCHY;
-		  }
+	if (childtype.equals("PagedHierarchy")) {
+	  
+	  return GSXML.DOC_TYPE_PAGED_HIERARCHY;
+	}
 	return GSXML.DOC_TYPE_HIERARCHY;
 
@@ -308,5 +307,5 @@
 		{
 			String child_id = child_ids.get(i);
-			Element child_elem = createDocNode(child_id);
+			Element child_elem = createDocNode(doc.getOwnerDocument(), 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)))
Index: main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSDocumentModel.java
===================================================================
--- main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSDocumentModel.java	(revision 28964)
+++ main/trunk/greenstone3/src/java/org/greenstone/gsdl3/util/GSDocumentModel.java	(revision 28965)
@@ -102,12 +102,10 @@
 
 	protected String _siteHome;
-	protected Document _mainDoc;
-	protected MessageRouter _router;
+ 	protected MessageRouter _router;
 	protected HashMap<String, Document> _docCache = new HashMap<String, Document>();
 
-	public GSDocumentModel(String siteHome, Document mainDocument, MessageRouter router)
+	public GSDocumentModel(String siteHome, MessageRouter router)
 	{
 		_siteHome = siteHome;
-		_mainDoc = mainDocument;
 		_router = router;
 	}
@@ -1702,5 +1700,5 @@
 		if (_errorMessageMap.get(_errorStatus) != null)
 		{
-			GSXML.addError(elem.getOwnerDocument(), elem, methodName + ": " + _errorMessageMap.get(_errorStatus), GSXML.ERROR_TYPE_SYNTAX);
+			GSXML.addError(elem, methodName + ": " + _errorMessageMap.get(_errorStatus), GSXML.ERROR_TYPE_SYNTAX);
 			return true;
 		}
@@ -2009,6 +2007,7 @@
 	{
 		//Find out what kind of database we have
-		Element dbTypeMessage = _mainDoc.createElement(GSXML.MESSAGE_ELEM);
-		Element dbTypeRequest = GSXML.createBasicRequest(_mainDoc, GSXML.REQUEST_TYPE_DESCRIBE, collection, userContext);
+	  Document doc = XMLConverter.newDOM();
+		Element dbTypeMessage = doc.createElement(GSXML.MESSAGE_ELEM);
+		Element dbTypeRequest = GSXML.createBasicRequest(doc, GSXML.REQUEST_TYPE_DESCRIBE, collection, userContext);
 		dbTypeMessage.appendChild(dbTypeRequest);
 		Element dbTypeResponse = (Element) _router.process(dbTypeMessage);
