protected object ReadReferencingElement(string name, string ns, bool elementCanBeType, out string fixupReference)
{
object o = null;
if (_callbacks == null)
{
_callbacks = new Hashtable();
_types = new Hashtable();
XmlQualifiedName urType = new XmlQualifiedName(_urTypeID, _r.NameTable.Add(XmlSchema.Namespace));
_types.Add(urType, typeof(object));
_typesReverse = new Hashtable();
_typesReverse.Add(typeof(object), urType);
InitCallbacks();
}
_r.MoveToContent();
if (ReadReference(out fixupReference)) return null;
if (ReadNull()) return null;
string id = _soap12 ? _r.GetAttribute("id", Soap12.Encoding) : _r.GetAttribute("id", null);
if ((o = ReadArray(name, ns)) == null)
{
XmlQualifiedName typeId = GetXsiType();
if (typeId == null)
{
if (name == null)
typeId = new XmlQualifiedName(_r.NameTable.Add(_r.LocalName), _r.NameTable.Add(_r.NamespaceURI));
else
typeId = new XmlQualifiedName(_r.NameTable.Add(name), _r.NameTable.Add(ns));
}
XmlSerializationReadCallback callback = (XmlSerializationReadCallback)_callbacks[typeId];
if (callback != null)
{
o = callback();
}
else
o = ReadTypedPrimitive(typeId, elementCanBeType);
}
AddTarget(id, o);
return o;
}