private object FindType(XmlQualifiedName name) { if (name != null && name.Namespace == Soap.Encoding) { // we have a build-in support fo the encoded types, we need to make sure that we generate the same // object model whether http://www.w3.org/2003/05/soap-encoding schema was specified or not. object type = Schemas.Find(name, typeof(XmlSchemaComplexType)); if (type != null) { XmlSchemaType encType = (XmlSchemaType)type; XmlQualifiedName baseType = encType.DerivedFrom; if (!baseType.IsEmpty) { return(FindType(baseType)); } return(encType); } return(FindDataType(name)); } else { object type = Schemas.Find(name, typeof(XmlSchemaComplexType)); if (type != null) { return(type); } return(FindDataType(name)); } }
private XmlSchemaSimpleType FindDataType(XmlQualifiedName name) { TypeDesc typeDesc = Scope.GetTypeDesc(name.Name, name.Namespace); if (typeDesc != null && typeDesc.DataType is XmlSchemaSimpleType) { return((XmlSchemaSimpleType)typeDesc.DataType); } XmlSchemaSimpleType dataType = (XmlSchemaSimpleType)Schemas.Find(name, typeof(XmlSchemaSimpleType)); if (dataType != null) { return(dataType); } if (name.Namespace == XmlSchema.Namespace) { return((XmlSchemaSimpleType)Scope.GetTypeDesc(typeof(string)).DataType); } else { throw new InvalidOperationException(SR.Format(SR.XmlMissingDataType, name.ToString())); } }