The base class for all simple types and complex types.
Inheritance: XmlSchemaAnnotated
 internal static bool IsSpecialXmlType(Type type, out XmlQualifiedName typeName, out XmlSchemaType xsdType, out bool hasRoot)
 {
     xsdType = null;
     hasRoot = true;
     if (type == Globals.TypeOfXmlElement || type == Globals.TypeOfXmlNodeArray)
     {
         string name = null;
         if (type == Globals.TypeOfXmlElement)
         {
             xsdType = CreateAnyElementType();
             name = "XmlElement";
             hasRoot = false;
         }
         else
         {
             xsdType = CreateAnyType();
             name = "ArrayOfXmlNode";
             hasRoot = true;
         }
         typeName = new XmlQualifiedName(name, DataContract.GetDefaultStableNamespace(type));
         return true;
     }
     typeName = null;
     return false;
 }
Beispiel #2
0
 public XQueryItem(object value, XmlSchemaType xmlType)
 {
     RawValue = value;
     if (xmlType == null)
         xmlType = XQuerySequenceType.XmlSchema.UntypedAtomic;
     _xmlType = xmlType;
 }
		public override string ImportSchemaType(XmlSchemaType type, XmlSchemaObject context, XmlSchemas schemas, XmlSchemaImporter importer, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeGenerationOptions options, CodeDomProvider codeProvider) {
			if (type == null) {
				return null;
			}

			if (importedTypes[type] != null) {
				mainNamespace.Imports.Add(new CodeNamespaceImport(typeof(DataSet).Namespace));
				compileUnit.ReferencedAssemblies.Add("System.Data.dll");
				return (string)importedTypes[type];
			}
			if (!(context is XmlSchemaElement))
				return null;

			if (type is XmlSchemaComplexType) {
				XmlSchemaComplexType ct = (XmlSchemaComplexType)type;
				if (ct.Particle is XmlSchemaSequence) {
					XmlSchemaObjectCollection items = ((XmlSchemaSequence)ct.Particle).Items;
					if (items.Count == 2 && items[0] is XmlSchemaAny && items[1] is XmlSchemaAny) {
						XmlSchemaAny any0 = (XmlSchemaAny)items[0];
						XmlSchemaAny any1 = (XmlSchemaAny)items[1];
						if (any0.Namespace == XmlSchema.Namespace && any1.Namespace == "urn:schemas-microsoft-com:xml-diffgram-v1") {
							string typeName = typeof(DataTable).FullName;
							importedTypes.Add(type, typeName);
							mainNamespace.Imports.Add(new CodeNamespaceImport(typeof(DataTable).Namespace));
							compileUnit.ReferencedAssemblies.Add("System.Data.dll");
							return typeName;
						}
					}
				}
			}
			return null;
		}
        //public override string ImportSchemaType(
        //    string name, 
        //    string ns, 
        //    XmlSchemaObject context, 
        //    XmlSchemas schemas, 
        //    XmlSchemaImporter importer,
        //    CodeCompileUnit compileUnit, 
        //    CodeNamespace mainNamespace, 
        //    CodeGenerationOptions options, 
        //    CodeDomProvider codeProvider)
        //{

        //    XmlSchemaSimpleType simpleType = (XmlSchemaSimpleType) schemas.Find(new XmlQualifiedName(name, ns), typeof(XmlSchemaSimpleType));
        //    return ImportSchemaType(
        //        simpleType, 
        //        context, 
        //        schemas, 
        //        importer, 
        //        compileUnit, 
        //        mainNamespace, 
        //        options, 
        //        codeProvider);
        //}

        public override string ImportSchemaType(
            XmlSchemaType type, 
            XmlSchemaObject context, 
            XmlSchemas schemas, 
            XmlSchemaImporter importer,
            CodeCompileUnit compileUnit, 
            CodeNamespace mainNamespace, 
            CodeGenerationOptions options, 
            CodeDomProvider codeProvider)
        {

            XmlSchemaAnnotated annotatedType  = type as XmlSchemaAnnotated;
            if (annotatedType == null)
                return null;

            if (annotatedType.Annotation == null)
                return null;

            // create the comments and add them to the hash table under the namespace of the object
            CreateComments(annotatedType);

            //mainNamespace.Types.

            return null;

        }
Beispiel #5
0
        //-----------------------------------------------
        // XmlAtomicValue constructors and methods
        //-----------------------------------------------

        internal XmlAtomicValue(XmlSchemaType xmlType, bool value)
        {
            if (xmlType == null) throw new ArgumentNullException(nameof(xmlType));
            _xmlType = xmlType;
            _clrType = TypeCode.Boolean;
            _unionVal.boolVal = value;
        }
 internal TypeDesc(string name, string fullName, XmlSchemaType dataType, TypeKind kind, TypeDesc baseTypeDesc, TypeFlags flags, string formatterName)
 {
     this.name = name.Replace('+', '.');
     this.fullName = fullName.Replace('+', '.');
     this.kind = kind;
     this.baseTypeDesc = baseTypeDesc;
     this.flags = flags;
     this.isXsdType = kind == TypeKind.Primitive;
     if (this.isXsdType)
     {
         this.weight = 1;
     }
     else if (kind == TypeKind.Enum)
     {
         this.weight = 2;
     }
     else if (this.kind == TypeKind.Root)
     {
         this.weight = -1;
     }
     else
     {
         this.weight = (baseTypeDesc == null) ? 0 : (baseTypeDesc.Weight + 1);
     }
     this.dataType = dataType;
     this.formatterName = formatterName;
 }
 internal SchemaObjectInfo(XmlSchemaType type, XmlSchemaElement element, XmlSchema schema, List<XmlSchemaType> knownTypes)
 {
     this.type = type;
     this.element = element;
     this.schema = schema;
     this.knownTypes = knownTypes;
 }
Beispiel #8
0
        /// <summary>
        /// Create a type in the schema object
        /// </summary>
        /// <param name="type">The type of schema to register</param>
        /// <param name="Name">The Name of the type</param>
        internal void CreateType(System.Xml.Schema.XmlSchemaType type, XmlQualifiedName Name)
        {
            if (Name == null || type == null)
            {
                return;
            }

            type.Name = Name.Name;

            // Copy target namespace(s)
            foreach (System.Xml.XmlQualifiedName s in type.Namespaces.ToArray())
            {
                if (!namespaces.Contains(s.Name) && s.Name != null)
                {
                    namespaces.Add(s.Name);
                }
            }

            if (type is System.Xml.Schema.XmlSchemaComplexType)
            {
                RegisterComplexType((System.Xml.Schema.XmlSchemaComplexType)type);
            }
            else
            {
                RegisterSimpleType((System.Xml.Schema.XmlSchemaSimpleType)type);
            }
        }
        internal static CodeTypeDeclaration CreateClassDeclaration(XmlSchemaType type)
        {
            string className = CodeIdentifier.MakeValid(type.QualifiedName.Name);
            CodeTypeDeclaration codeClass = new CodeTypeDeclaration(className);
            codeClass.TypeAttributes |= TypeAttributes.Public;

            return codeClass;
        }
		private void Init (DateTime value, XmlSchemaType xmlType)
		{
			if (xmlType == null)
				throw new ArgumentNullException ("xmlType");
			xmlTypeCode = XmlTypeCode.DateTime;
			this.dateTimeValue = value;
			schemaType = xmlType;
		}
		private void Init (bool value, XmlSchemaType xmlType)
		{
			if (xmlType == null)
				throw new ArgumentNullException ("xmlType");
			xmlTypeCode = XmlTypeCode.Boolean;
			this.booleanValue = value;
			schemaType = xmlType;
		}
Beispiel #12
0
		private void Init (byte [] value, XmlSchemaType xmlType)
		{
			if (xmlType == null)
				throw new ArgumentNullException ("xmlType");
			xmlTypeCode = XmlTypeCode.Base64Binary;
			this.bytesValue = value;
			schemaType = xmlType;
		}
 internal XmlNameEx(string prefix, string localName, string ns, int hashCode, XmlDocument ownerDoc, XmlName next, IXmlSchemaInfo schemaInfo) : base(prefix, localName, ns, hashCode, ownerDoc, next)
 {
     this.SetValidity(schemaInfo.Validity);
     this.SetIsDefault(schemaInfo.IsDefault);
     this.SetIsNil(schemaInfo.IsNil);
     this.memberType = schemaInfo.MemberType;
     this.schemaType = schemaInfo.SchemaType;
     this.decl = (schemaInfo.SchemaElement != null) ? ((object) schemaInfo.SchemaElement) : ((object) schemaInfo.SchemaAttribute);
 }
Beispiel #14
0
 internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
 {
     if (IsSpecialXmlType(type, out stableName, out xsdType, out hasRoot))
         return;
     XmlSchemaSet schemas = null;
     InvokeSchemaProviderMethod(type, schemas, out stableName, out xsdType, out hasRoot);
     if (stableName.Name == null || stableName.Name.Length == 0)
         throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.InvalidXmlDataContractName, DataContract.GetClrTypeFullName(type))));
 }
 internal XmlAtomicValue(XmlSchemaType xmlType, bool value)
 {
     if (xmlType == null)
     {
         throw new ArgumentNullException("xmlType");
     }
     this.xmlType = xmlType;
     this.clrType = TypeCode.Boolean;
     this.unionVal.boolVal = value;
 }
 internal XmlAtomicValue(XmlSchemaType xmlType, double value)
 {
     if (xmlType == null)
     {
         throw new ArgumentNullException("xmlType");
     }
     this.xmlType = xmlType;
     this.clrType = TypeCode.Double;
     this.unionVal.dblVal = value;
 }
 internal XmlAtomicValue(XmlSchemaType xmlType, long value)
 {
     if (xmlType == null)
     {
         throw new ArgumentNullException("xmlType");
     }
     this.xmlType = xmlType;
     this.clrType = TypeCode.Int64;
     this.unionVal.i64Val = value;
 }
 XObject[] CreateProtoAnyType(XmlSchemaType schemaType) {
     if ((schemaType as XmlSchemaComplexType) != null) {
         return CreateProtoComplexType(schemaType as XmlSchemaComplexType);
     } else if ((schemaType as XmlSchemaSimpleType) != null) {
         var value = CreateProtoSimpleType(schemaType as XmlSchemaSimpleType);
         return new XObject[] { new XText(value) };
     } else {
         throw new Exception("invalid schema type");
     }
 }
Beispiel #19
0
 internal static void GetXmlTypeInfo(Type type, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
 {
     if (IsSpecialXmlType(type, out stableName, out xsdType, out hasRoot))
         return;
     XmlSchemaSet schemas = new XmlSchemaSet();
     schemas.XmlResolver = null;
     InvokeSchemaProviderMethod(type, schemas, out stableName, out xsdType, out hasRoot);
     if (stableName.Name == null || stableName.Name.Length == 0)
         throw Fx.Exception.AsError(new InvalidDataContractException(SR.InvalidXmlDataContractName(DataContract.GetClrTypeFullName(type))));
 }
Beispiel #20
0
        private static bool InvokeSchemaProviderMethod(Type clrType, XmlSchemaSet schemas, out XmlQualifiedName stableName, out XmlSchemaType xsdType, out bool hasRoot)
        {
            xsdType = null;
            hasRoot = true;
            object[] attrs = clrType.GetTypeInfo().GetCustomAttributes(Globals.TypeOfXmlSchemaProviderAttribute, false).ToArray();
            if (attrs == null || attrs.Length == 0)
            {
                stableName = DataContract.GetDefaultStableName(clrType);
                return false;
            }

            XmlSchemaProviderAttribute provider = (XmlSchemaProviderAttribute)attrs[0];
            if (provider.IsAny)
            {
                xsdType = CreateAnyElementType();
                hasRoot = false;
            }
            string methodName = provider.MethodName;
            if (methodName == null || methodName.Length == 0)
            {
                if (!provider.IsAny)
                    throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.InvalidGetSchemaMethod, DataContract.GetClrTypeFullName(clrType))));
                stableName = DataContract.GetDefaultStableName(clrType);
            }
            else
            {
                MethodInfo getMethod = clrType.GetMethod(methodName,  /*BindingFlags.DeclaredOnly |*/ BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public, new Type[] { typeof(XmlSchemaSet) });
                if (getMethod == null)
                    throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.MissingGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName)));

                if (!(Globals.TypeOfXmlQualifiedName.IsAssignableFrom(getMethod.ReturnType)))
                    throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.InvalidReturnTypeOnGetSchemaMethod, DataContract.GetClrTypeFullName(clrType), methodName, DataContract.GetClrTypeFullName(getMethod.ReturnType), DataContract.GetClrTypeFullName(Globals.TypeOfXmlQualifiedName))));

                object typeInfo = getMethod.Invoke(null, new object[] { schemas });

                if (provider.IsAny)
                {
                    if (typeInfo != null)
                        throw System.Runtime.Serialization.DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidDataContractException(SR.Format(SR.InvalidNonNullReturnValueByIsAny, DataContract.GetClrTypeFullName(clrType), methodName)));
                    stableName = DataContract.GetDefaultStableName(clrType);
                }
                else if (typeInfo == null)
                {
                    xsdType = CreateAnyElementType();
                    hasRoot = false;
                    stableName = DataContract.GetDefaultStableName(clrType);
                }
                else
                {
                    stableName = (XmlQualifiedName)typeInfo;
                }
            }
            return true;
        }
		public override string ImportSchemaType (XmlSchemaType type, XmlSchemaObject context, XmlSchemas schemas, XmlSchemaImporter importer, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeGenerationOptions options, CodeDomProvider codeProvider)
		{
			if (type == null)
				return null;

			var xe = context as XmlSchemaElement;
			if (xe == null)
				return null;

			return null;
		}
 internal void Clear()
 {
     this.isNil = false;
     this.isDefault = false;
     this.schemaType = null;
     this.schemaElement = null;
     this.schemaAttribute = null;
     this.memberType = null;
     this.validity = XmlSchemaValidity.NotKnown;
     this.contentType = XmlSchemaContentType.Empty;
 }
Beispiel #23
0
		public static void AssertElement (XmlSchemaElement element,
			string name, XmlQualifiedName refName, string id,
			XmlQualifiedName schemaTypeName, XmlSchemaType schemaType)
		{
			Assert.IsNotNull (element);
			Assert.AreEqual (name, element.Name);
			Assert.AreEqual (refName, element.RefName);
			Assert.AreEqual (id, element.Id);
			Assert.AreEqual (schemaTypeName, element.SchemaTypeName);
			Assert.AreEqual (schemaType, element.SchemaType);
		}
Beispiel #24
0
 private static CompiledFacets GetFacets(XmlSchemaType type)
 {
     CompiledFacets compiledFacets = new CompiledFacets(type.Datatype);
     XmlSchemaSimpleType simpleType = type as XmlSchemaSimpleType;
     
     if(simpleType != null)
     {
         compiledFacets.compileFacets(simpleType);
     }
     return compiledFacets;
 }
		protected void AssertElement (XmlSchemaElement element,
			string name, XmlQualifiedName refName, string id,
			XmlQualifiedName schemaTypeName, XmlSchemaType schemaType)
		{
			AssertNotNull (element);
			AssertEquals (name, element.Name);
			AssertEquals (refName, element.RefName);
			AssertEquals (id, element.Id);
			AssertEquals (schemaTypeName, element.SchemaTypeName);
			AssertEquals (schemaType, element.SchemaType);
		}
 private static void WriteImageWithTopicLink(this MamlWriter writer, TopicManager topicManager, ArtItem artItem, XmlSchemaType type)
 {
     var topic = topicManager.GetTopic(type);
     if (topic != null)
     {
         writer.WriteHtmlArtItemWithTopicLink(artItem, topic);
     }
     else
     {
         writer.WriteHtmlArtItemWithText(artItem, type.QualifiedName.Name);
     }
 }
		public virtual string ImportSchemaType (
			XmlSchemaType type, 
			XmlSchemaObject context, 
			XmlSchemas schemas, 
			XmlSchemaImporter importer, 
			CodeCompileUnit compileUnit, 
			CodeNamespace mainNamespace, 
			CodeGenerationOptions options, 
			CodeDomProvider codeProvider
		)
		{
			return null;
		}
Beispiel #28
0
 public XmlSampleGenerator(XmlSchemaSet schemaSet, XmlQualifiedName rootElem)
 {
     if (schemaSet == null || schemaSet.Count == 0)
         throw new Exception("Provided Schema set is empty. Xml cannot be generated.");
     this.schemaSet = schemaSet;
     schemaSet.ValidationEventHandler += new ValidationEventHandler(ValidationCallBack);
     if (xmlResolver == null) {
         xmlResolver = new XmlUrlResolver();
     }
     schemaSet.XmlResolver = xmlResolver;
     rootElement = rootElem;
     AnyType = XmlSchemaType.GetBuiltInComplexType(XmlTypeCode.Item);
 }
 internal XmlAtomicValue(XmlSchemaType xmlType, string value)
 {
     if (value == null)
     {
         throw new ArgumentNullException("value");
     }
     if (xmlType == null)
     {
         throw new ArgumentNullException("xmlType");
     }
     this.xmlType = xmlType;
     this.objVal = value;
 }
 public override string ImportSchemaType(XmlSchemaType type, XmlSchemaObject context, XmlSchemas schemas, XmlSchemaImporter importer, CodeCompileUnit compileUnit, CodeNamespace mainNamespace, CodeGenerationOptions options, CodeDomProvider codeProvider)
 {
     if ((!this.m_direct && (type is XmlSchemaSimpleType)) && (context is XmlSchemaElement))
     {
         XmlQualifiedName qualifiedName = ((XmlSchemaSimpleType) type).BaseXmlSchemaType.QualifiedName;
         if ((string.CompareOrdinal(this.m_name, qualifiedName.Name) == 0) && (string.CompareOrdinal(this.m_targetNamespace, qualifiedName.Namespace) == 0))
         {
             compileUnit.ReferencedAssemblies.AddRange(this.m_references);
             mainNamespace.Imports.AddRange(this.m_namespaceImports);
             return this.m_destinationType;
         }
     }
     return null;
 }
		private static bool IsExpression(XmlSchemaType schemaType)
		{
			if (schemaType.Name == "Expression")
			{
				return true;
			}

			if (schemaType.BaseXmlSchemaType != null)
			{
				return IsExpression(schemaType.BaseXmlSchemaType);
			}

			return false;
		}
Beispiel #32
0
        private static void AddPrimitive(Type type, string dataTypeName, string formatterName, TypeFlags flags)
        {
            XmlSchemaSimpleType dataType = new XmlSchemaSimpleType();

            dataType.Name = dataTypeName;
            TypeDesc typeDesc = new TypeDesc(type, true, dataType, formatterName, flags);

            if (s_primitiveTypes[type] == null)
            {
                s_primitiveTypes.Add(type, typeDesc);
            }
            s_primitiveDataTypes.Add(dataType, typeDesc);
            s_primitiveNames.Add(dataTypeName, XmlSchema.Namespace, typeDesc);
        }
Beispiel #33
0
        private static void AddNonXsdPrimitive(Type type, string dataTypeName, string ns, string formatterName, XmlQualifiedName baseTypeName, XmlSchemaFacet[] facets, TypeFlags flags)
        {
            XmlSchemaSimpleType dataType = new XmlSchemaSimpleType();

            dataType.Name = dataTypeName;
            TypeDesc typeDesc = new TypeDesc(type, false, dataType, formatterName, flags);

            if (s_primitiveTypes[type] == null)
            {
                s_primitiveTypes.Add(type, typeDesc);
            }
            s_primitiveDataTypes.Add(dataType, typeDesc);
            s_primitiveNames.Add(dataTypeName, ns, typeDesc);
        }
Beispiel #34
0
        private Parameter[] GetParameters(string messagePartName)
        {
            List <Parameter> parameters = new List <Parameter>();

            //Types types = serviceDescription.Types;
            //System.Xml.Schema.XmlSchema xmlSchema = types.Schemas[0];

            foreach (XmlSchemaElement schemaElement in e.GlobalElements.Values)
            {
                //}
                //foreach (object item in xmlSchema.Items)
                //{
                //    System.Xml.Schema.XmlSchemaElement schemaElement = item as System.Xml.Schema.XmlSchemaElement;
                if (schemaElement != null)
                {
                    if (schemaElement.Name == messagePartName)
                    {
                        System.Xml.Schema.XmlSchemaType        schemaType  = schemaElement.SchemaType;
                        System.Xml.Schema.XmlSchemaComplexType complexType =
                            schemaType as System.Xml.Schema.XmlSchemaComplexType;
                        if (complexType != null)
                        {
                            System.Xml.Schema.XmlSchemaParticle particle = complexType.Particle;
                            System.Xml.Schema.XmlSchemaSequence sequence = particle as System.Xml.Schema.XmlSchemaSequence;
                            if (sequence != null)
                            {
                                foreach (System.Xml.Schema.XmlSchemaElement childElement in sequence.Items)
                                {
                                    string parameterName = childElement.Name;
                                    string parameterType = childElement.SchemaTypeName.Name;
                                    parameters.Add(new Parameter(parameterName, parameterType, null, null));
                                }
                            }
                        }
                        break;
                    }
                }
            }
            return(parameters.ToArray());
        }
 internal abstract XmlSchemaDatatype DeriveByRestriction(XmlSchemaObjectCollection facets, XmlNameTable nameTable, XmlSchemaType schemaType);
 public static XmlValueConverter Create(XmlSchemaType schemaType)
 {
     return(new XmlNumeric10Converter(schemaType));
 }
 protected XmlNumeric10Converter(XmlSchemaType schemaType) : base(schemaType)
 {
 }
Beispiel #38
0
 internal static XmlSchemaDatatype DeriveByUnion(XmlSchemaSimpleType[] types, XmlSchemaType schemaType)
 {
     return(DatatypeImplementation.DeriveByUnion(types, schemaType));
 }
Beispiel #39
0
        //-----------------------------------------------
        // XmlAtomicValue constructors and methods
        //-----------------------------------------------

        internal XmlAtomicValue(XmlSchemaType xmlType !!, bool value)
Beispiel #40
0
        private ComplexType ToComplexType(Element el)
        {
            QName         name = el.SchemaTypeName;
            XmlSchemaType type = el.SchemaType;

            // 1. element type is complex.
            ComplexType ct = type as ComplexType;

            if (ct != null)
            {
                return(ct);
            }

            // 2. reference to global complexType.
            XmlSchemaType globalType = schemas.GlobalTypes [name]
                                       as XmlSchemaType;

            ct = globalType as ComplexType;
            if (ct != null)
            {
                return(ct);
            }

            ct                = new ComplexType();
            el.SchemaType     = ct;
            el.SchemaTypeName = QName.Empty;

            // 3. base type name is xs:anyType or no specification.
            // <xs:complexType />
            if (name == QNameAnyType)
            {
                return(ct);
            }
            else if (type == null && name == QName.Empty)
            {
                return(ct);
            }

            SimpleModel sc = new SimpleModel();

            ct.ContentModel = sc;

            // 4. type is simpleType
            //    -> extension of existing simple type.
            SimpleType st = type as SimpleType;

            if (st != null)
            {
                SimpleRst scr = new SimpleRst();
                scr.BaseType = st;
                sc.Content   = scr;
                return(ct);
            }

            SimpleExt sce = new SimpleExt();

            sc.Content = sce;

            // 5. type name points to primitive type
            //    -> simple extension of a primitive type
            st = XmlSchemaType.GetBuiltInSimpleType(name);
            if (st != null)
            {
                sce.BaseTypeName = name;
                return(ct);
            }

            // 6. type name points to global simpleType.
            st = globalType as SimpleType;
            if (st != null)
            {
                sce.BaseTypeName = name;
                return(ct);
            }

            throw Error(el, "Unexpected schema component that contains simpleTypeName that could not be resolved.");
        }
 internal override XmlValueConverter CreateValueConverter(XmlSchemaType schemaType)
 {
     return(XmlMiscConverter.Create(schemaType));
 }
        internal override int Validate(ValidationEventHandler h, XmlSchema schema)
        {
            if (base.IsValidated(schema.ValidationId))
            {
                return(this.errorCount);
            }
            ArrayList arrayList = new ArrayList();

            if (this.MemberTypes != null)
            {
                foreach (XmlQualifiedName xmlQualifiedName in this.MemberTypes)
                {
                    object        obj           = null;
                    XmlSchemaType xmlSchemaType = schema.FindSchemaType(xmlQualifiedName) as XmlSchemaSimpleType;
                    if (xmlSchemaType != null)
                    {
                        this.errorCount += xmlSchemaType.Validate(h, schema);
                        obj              = xmlSchemaType;
                    }
                    else if (xmlQualifiedName == XmlSchemaComplexType.AnyTypeName)
                    {
                        obj = XmlSchemaSimpleType.AnySimpleType;
                    }
                    else if (xmlQualifiedName.Namespace == "http://www.w3.org/2001/XMLSchema" || xmlQualifiedName.Namespace == "http://www.w3.org/2003/11/xpath-datatypes")
                    {
                        obj = XmlSchemaDatatype.FromName(xmlQualifiedName);
                        if (obj == null)
                        {
                            base.error(h, "Invalid schema type name was specified: " + xmlQualifiedName);
                        }
                    }
                    else if (!schema.IsNamespaceAbsent(xmlQualifiedName.Namespace))
                    {
                        base.error(h, "Referenced base schema type " + xmlQualifiedName + " was not found in the corresponding schema.");
                    }
                    arrayList.Add(obj);
                }
            }
            if (this.BaseTypes != null)
            {
                foreach (XmlSchemaObject xmlSchemaObject in this.BaseTypes)
                {
                    XmlSchemaSimpleType xmlSchemaSimpleType = (XmlSchemaSimpleType)xmlSchemaObject;
                    xmlSchemaSimpleType.Validate(h, schema);
                    arrayList.Add(xmlSchemaSimpleType);
                }
            }
            this.validatedTypes = arrayList.ToArray();
            if (this.validatedTypes != null)
            {
                this.validatedSchemaTypes = new XmlSchemaSimpleType[this.validatedTypes.Length];
                for (int j = 0; j < this.validatedTypes.Length; j++)
                {
                    object obj2 = this.validatedTypes[j];
                    XmlSchemaSimpleType xmlSchemaSimpleType2 = obj2 as XmlSchemaSimpleType;
                    if (xmlSchemaSimpleType2 == null && obj2 != null)
                    {
                        xmlSchemaSimpleType2 = XmlSchemaType.GetBuiltInSimpleType(((XmlSchemaDatatype)obj2).TypeCode);
                    }
                    this.validatedSchemaTypes[j] = xmlSchemaSimpleType2;
                }
            }
            this.ValidationId = schema.ValidationId;
            return(this.errorCount);
        }
Beispiel #43
0
 internal abstract XmlSchemaDatatype DeriveByList(XmlSchemaType schemaType);
Beispiel #44
0
 internal void SetElementType(XmlSchemaType value)
 {
     elementType = value;
 }