         return xmlDocument;
     }
 
-    public function encodeValue(obj:Object, q:*, parentNode:XMLNode):XMLNode
+    public function encodeValue(obj:Object, q:*, parentNode:XMLNode, recurse:Boolean=true):XMLNode
     {
         var qname:XObjQName = new XObjQName();;
         

                    continue;
                
                var propQName:XObjQName = new XObjQName("", fieldName);
                encodeValue(obj[fieldName], propQName, myElement);
            }
        }
        else if (typeType == XObjXMLEncoder.ARRAY_TYPE)

            newNode.nodeName = XObjUtils.encodeElementTag(qname, newNode);
            return newNode;
        }
        else if (recurse)
        {
            if (obj is IXObjReference)
            {
                // don't recurse refs
                return internal_encodeValue(obj, qname, parentNode, false);
            }
            else
                return internal_encodeValue(obj, qname, parentNode);
        }
        else
        {
            // else skip it - likely an XObjRef from earlier
            return null;
        }
    }
    
    protected function internal_encodeValue(obj:Object, qname:XObjQName, parentNode:XMLNode, recurse:Boolean=true):XMLNode
    {
        var myElement:XMLNode;
        
