 import flash.xml.XMLDocument;
 import flash.xml.XMLNode;
 
-import mx.collections.IList;
-import mx.core.mx_internal;
 import mx.logging.ILogger;
 import mx.logging.Log;
 import mx.rpc.soap.types.ICustomSOAPType;
+import mx.rpc.wsdl.WSDLEncoding;
 import mx.rpc.wsdl.WSDLMessagePart;
-import mx.rpc.wsdl.WSDLConstants;
-import mx.rpc.wsdl.WSDLEncoding;
 import mx.rpc.wsdl.WSDLOperation;
 import mx.rpc.xml.ContentProxy;
 import mx.rpc.xml.DecodingContext;

        {
            if (child.nodeKind() == "element")
            {
                var element:XML = child;
                var href:String = getAttributeFromNode("href", element);
                if (href != null)
                {
                    var hashPosition:int = href.indexOf("#");
                    if (hashPosition >= 0)
                        href = href.substring(hashPosition + 1);
    
                    // Find the first element with a matching id attribute 
                    var matches:XMLList = _elementsWithId.(@id == href);
                    var referent:XML;
                    
                    if (matches.length() > 0)
                        referent = matches[0];
                    else
                        throw new Error("The element referenced by id '" + href + "' was not found.");
                        
                    referent.setName(element.name());
                    
                    if (referent.hasComplexContent())
                        resolveReferences(referent, false);
                        
                    root.replace(index, referent);
                }
                else if (element.hasComplexContent())
                {
                    resolveReferences(element, false);
                }
            }

            index++;
        }
        
        if (cleanupElementsWithIdCache)
        {
            _elementsWithId = null;

import mx.rpc.xml.SchemaDatatypes;
import mx.rpc.xml.TypeIterator;
import mx.rpc.xml.XMLDecoder;
import mx.utils.StringUtil;
import mx.utils.XMLUtil;
import mx.utils.object_proxy;

use namespace object_proxy;

