AddType() публичный Метод

public AddType ( XmlSchemaType type ) : SymbolEntry
type System.Xml.Schema.XmlSchemaType
Результат SymbolEntry
Пример #1
0
        internal void TypesToTypes()
        {
            foreach (XmlSchemaType st in schemas.GlobalTypes.Values)
            {
                XmlSchemaSimpleType simpleType = st as XmlSchemaSimpleType;
                if (simpleType != null)
                {
                    SymbolEntry symbol       = symbolTable.AddType(simpleType);
                    string      xsdNamespace = simpleType.QualifiedName.Namespace;
                    ClrSimpleTypeInfo
                        typeInfo = ClrSimpleTypeInfo
                                   .CreateSimpleTypeInfo(simpleType); //Create corresponding simple type info objects
                    typeInfo.IsAbstract  = false;
                    typeInfo.clrtypeName = symbol.identifierName;
                    typeInfo.clrtypeNs   = symbol.clrNamespace;
                    typeInfo.schemaName  = symbol.symbolName;
                    typeInfo.schemaNs    = xsdNamespace;
                    typeInfo.typeOrigin  = SchemaOrigin.Fragment;
                    BuildAnnotationInformation(typeInfo, st);
                    binding.Types.Add(typeInfo);
                }
                else
                {
                    XmlSchemaComplexType ct = st as XmlSchemaComplexType;
                    if (ct != null && ct.TypeCode != XmlTypeCode.Item)
                    {
                        SymbolEntry symbol       = symbolTable.AddType(ct);
                        string      xsdNamespace = ct.QualifiedName.Namespace;

                        localSymbolTable.Init(symbol.identifierName);

                        ClrContentTypeInfo typeInfo = new ClrContentTypeInfo();
                        typeInfo.IsAbstract  = ct.IsAbstract;
                        typeInfo.IsSealed    = ct.IsFinal();
                        typeInfo.clrtypeName = symbol.identifierName;
                        typeInfo.clrtypeNs   = symbol.clrNamespace;
                        typeInfo.schemaName  = symbol.symbolName;
                        typeInfo.schemaNs    = xsdNamespace;

                        typeInfo.typeOrigin = SchemaOrigin.Fragment;
                        typeInfo.baseType   = BaseType(ct);
                        BuildProperties(null, ct, typeInfo);
                        BuildNestedTypes(typeInfo);
                        BuildAnnotationInformation(typeInfo, ct);
                        binding.Types.Add(typeInfo);
                    }
                }
            }
        }
        internal void AddSimpleType(XmlQualifiedName name, XmlSchemaSimpleType simpleType)
        {
            SymbolEntry symbol       = symbolTable.AddType(name, simpleType);
            string      xsdNamespace = simpleType.QualifiedName.Namespace;
            // Create corresponding simple type info objects
            ClrSimpleTypeInfo typeInfo = ClrSimpleTypeInfo.CreateSimpleTypeInfo(simpleType);

            typeInfo.IsAbstract  = false;
            typeInfo.clrtypeName = symbol.identifierName;
            typeInfo.clrtypeNs   = symbol.clrNamespace;
            typeInfo.schemaName  = symbol.symbolName;
            typeInfo.schemaNs    = xsdNamespace;
            typeInfo.typeOrigin  = SchemaOrigin.Fragment;
            BuildAnnotationInformation(typeInfo, simpleType);
            binding.Types.Add(typeInfo);
        }