当前位置: 首页>>代码示例>>C#>>正文


C# Schema.SchemaInfo类代码示例

本文整理汇总了C#中System.Xml.Schema.SchemaInfo的典型用法代码示例。如果您正苦于以下问题:C# SchemaInfo类的具体用法?C# SchemaInfo怎么用?C# SchemaInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


SchemaInfo类属于System.Xml.Schema命名空间,在下文中一共展示了SchemaInfo类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Init

        private void Init()
        {
            _nsManager = reader.NamespaceManager;
            if (_nsManager == null)
            {
                _nsManager = new XmlNamespaceManager(NameTable);
                _bManageNamespaces = true;
            }
            _validationStack = new HWStack(STACK_INCREMENT);
            textValue = new StringBuilder();
            _attPresence = new Hashtable();
            schemaInfo = new SchemaInfo();
            checkDatatype = false;
            _processContents = XmlSchemaContentProcessing.Strict;
            Push(XmlQualifiedName.Empty);

            //Add common strings to be compared to NameTable
            _nsXmlNs = NameTable.Add(XmlReservedNs.NsXmlNs);
            _nsXs = NameTable.Add(XmlReservedNs.NsXs);
            _nsXsi = NameTable.Add(XmlReservedNs.NsXsi);
            _xsiType = NameTable.Add("type");
            _xsiNil = NameTable.Add("nil");
            _xsiSchemaLocation = NameTable.Add("schemaLocation");
            _xsiNoNamespaceSchemaLocation = NameTable.Add("noNamespaceSchemaLocation");
            _xsdSchema = NameTable.Add("schema");
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:26,代码来源:XsdValidator.cs

示例2: StartParsingAsync

        public async Task StartParsingAsync(XmlReader reader, string targetNamespace) {
            this.reader = reader;
            positionInfo = PositionInfo.GetPositionInfo(reader);
            namespaceManager = reader.NamespaceManager;
            if (namespaceManager == null) {
                namespaceManager = new XmlNamespaceManager(nameTable);
                isProcessNamespaces = true;
            } 
            else {
                isProcessNamespaces = false;
            }
            while (reader.NodeType != XmlNodeType.Element && await reader.ReadAsync().ConfigureAwait(false)) {}

            markupDepth = int.MaxValue;
            schemaXmlDepth = reader.Depth;
            SchemaType rootType = schemaNames.SchemaTypeFromRoot(reader.LocalName, reader.NamespaceURI);
            
            string code;
            if (!CheckSchemaRoot(rootType, out code)) {
                throw new XmlSchemaException(code, reader.BaseURI, positionInfo.LineNumber, positionInfo.LinePosition);
            }
            
            if (schemaType == SchemaType.XSD) {
                schema = new XmlSchema();
                schema.BaseUri = new Uri(reader.BaseURI, UriKind.RelativeOrAbsolute);
                builder = new XsdBuilder(reader, namespaceManager, schema, nameTable, schemaNames, eventHandler);
            }
            else {  
                Debug.Assert(schemaType == SchemaType.XDR);
                xdrSchema = new SchemaInfo();
                xdrSchema.SchemaType = SchemaType.XDR;
                builder = new XdrBuilder(reader, namespaceManager, xdrSchema, targetNamespace, nameTable, schemaNames, eventHandler);
                ((XdrBuilder)builder).XmlResolver = xmlResolver;
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:35,代码来源:ParserAsync.cs

示例3: StartParsing

        internal void StartParsing(XmlReader reader, string targetNamespace, SchemaInfo schemaInfo) {
            this.reader = reader;
            positionInfo = PositionInfo.GetPositionInfo(reader);
            this.namespaceManager = reader.NamespaceManager;
            if (this.namespaceManager == null) {
                this.namespaceManager = new XmlNamespaceManager(this.nameTable);
                this.isProcessNamespaces = true;
            } 
            else {
                this.isProcessNamespaces = false;
            }
            while (this.reader.NodeType != XmlNodeType.Element && this.reader.Read()) {}

            this.markupDepth = int.MaxValue;
			this.schemaXmlDepth = reader.Depth;
            XmlQualifiedName qname = new XmlQualifiedName(this.reader.LocalName, XmlSchemaDatatype.XdrCanonizeUri(this.reader.NamespaceURI, this.nameTable, this.schemaNames));
            if (this.schemaNames.IsXDRRoot(qname)) {
                Debug.Assert(schemaInfo != null);
                schemaInfo.SchemaType = SchemaType.XDR;
                this.schema = null;
                this.builder = new XdrBuilder(reader, this.namespaceManager, schemaInfo, targetNamespace, this.nameTable, this.schemaNames, this.validationEventHandler);
            }
            else if (this.schemaNames.IsXSDRoot(qname)) {
                if (schemaInfo != null) {
                    schemaInfo.SchemaType = SchemaType.XSD;
                }
                this.schema = new XmlSchema();
                this.schema.BaseUri = reader.BaseURI;
                this.builder = new XsdBuilder(reader, this.namespaceManager, this.schema, this.nameTable, this.schemaNames, this.validationEventHandler);
            }
            else { 
                throw new XmlSchemaException(Res.Sch_SchemaRootExpected, reader.BaseURI, positionInfo.LineNumber, positionInfo.LinePosition);
            }
                
        }
开发者ID:ArildF,项目名称:masters,代码行数:35,代码来源:parser.cs

示例4: Compile

 internal void Compile(XmlSchema schema, string targetNamespace, SchemaInfo schemaInfo) {
     //CompModSwitches.XmlSchema.Level = TraceLevel.Error;
     schema.ErrorCount = 0;
     Preprocess(schema, targetNamespace);
     if (schema.ErrorCount == 0) {
         CompileTo(schemaInfo);
     }
 }
开发者ID:ArildF,项目名称:masters,代码行数:8,代码来源:compiler.cs

示例5: Init

 private void Init() {
     Debug.Assert(reader != null);
     validationStack = new HWStack(STACK_INCREMENT);
     textValue = new StringBuilder();
     name = XmlQualifiedName.Empty;
     attPresence = new Hashtable();
     schemaInfo = new SchemaInfo();
     checkDatatype = false;
     Push(name);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:10,代码来源:DtdValidator.cs

示例6: Execute

 public bool Execute(XmlSchemaSet schemaSet, SchemaInfo schemaCompiledInfo) {
     Compile();
     if (!HasErrors) {
         Output(schemaCompiledInfo);
         schemaSet.elements = elements;
         schemaSet.attributes = attributes;
         schemaSet.schemaTypes = schemaTypes;
         schemaSet.substitutionGroups = examplars;
     }
     return !HasErrors;
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:SchemaSetCompiler.cs

示例7: Execute

 public bool Execute(XmlSchema schema, SchemaInfo schemaInfo, bool compileContentModel) {
     this.compileContentModel = compileContentModel;
     this.schema = schema;
     Prepare();
     Cleanup();
     Compile();
     if (!HasErrors) {
         Output(schemaInfo);
     }
     return !HasErrors;
 }
开发者ID:uQr,项目名称:referencesource,代码行数:11,代码来源:SchemaCollectionCompiler.cs

示例8: CheckDefaultValue

 public static void CheckDefaultValue(string value, SchemaAttDef attdef, SchemaInfo sinfo, XmlNamespaceManager nsManager, XmlNameTable NameTable, object sender, ValidationEventHandler eventhandler, string baseUri, int lineNo, int linePos)
 {
     try
     {
         XmlSchemaDatatype datatype = attdef.Datatype;
         if (datatype != null)
         {
             if (datatype.TokenizedType != XmlTokenizedType.CDATA)
             {
                 value = value.Trim();
             }
             if (value.Length != 0)
             {
                 object pVal = datatype.ParseValue(value, NameTable, nsManager);
                 XmlTokenizedType tokenizedType = datatype.TokenizedType;
                 if (tokenizedType == XmlTokenizedType.ENTITY)
                 {
                     if (datatype.Variety == XmlSchemaDatatypeVariety.List)
                     {
                         string[] strArray = (string[]) pVal;
                         for (int i = 0; i < strArray.Length; i++)
                         {
                             BaseValidator.ProcessEntity(sinfo, strArray[i], sender, eventhandler, baseUri, lineNo, linePos);
                         }
                     }
                     else
                     {
                         BaseValidator.ProcessEntity(sinfo, (string) pVal, sender, eventhandler, baseUri, lineNo, linePos);
                     }
                 }
                 else if ((tokenizedType == XmlTokenizedType.ENUMERATION) && !attdef.CheckEnumeration(pVal))
                 {
                     XmlSchemaException ex = new XmlSchemaException("Sch_EnumerationValue", pVal.ToString(), baseUri, lineNo, linePos);
                     if (eventhandler == null)
                     {
                         throw ex;
                     }
                     eventhandler(sender, new ValidationEventArgs(ex));
                 }
                 attdef.DefaultValueTyped = pVal;
             }
         }
     }
     catch
     {
         XmlSchemaException exception2 = new XmlSchemaException("Sch_AttributeDefaultDataType", attdef.Name.ToString(), baseUri, lineNo, linePos);
         if (eventhandler == null)
         {
             throw exception2;
         }
         eventhandler(sender, new ValidationEventArgs(exception2));
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:53,代码来源:XdrValidator.cs

示例9: Init

 private void Init() {
     nsManager = reader.NamespaceManager;
     if (nsManager == null) {
         nsManager = new XmlNamespaceManager(NameTable);
         isProcessContents = true;
     }
     validationStack = new HWStack(STACK_INCREMENT);
     textValue = new StringBuilder();
     name = XmlQualifiedName.Empty;
     attPresence = new Hashtable();
     Push(XmlQualifiedName.Empty);
     schemaInfo = new SchemaInfo();
     checkDatatype = false;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:14,代码来源:xdrvalidator.cs

示例10: Add

 internal void Add(SchemaInfo sinfo, ValidationEventHandler eventhandler)
 {
     if (this.schemaType == System.Xml.Schema.SchemaType.None)
     {
         this.schemaType = sinfo.SchemaType;
     }
     else if (this.schemaType != sinfo.SchemaType)
     {
         if (eventhandler != null)
         {
             eventhandler(this, new ValidationEventArgs(new XmlSchemaException("Sch_MixSchemaTypes", string.Empty)));
         }
         return;
     }
     foreach (string str in sinfo.TargetNamespaces.Keys)
     {
         if (!this.targetNamespaces.ContainsKey(str))
         {
             this.targetNamespaces.Add(str, true);
         }
     }
     foreach (KeyValuePair<XmlQualifiedName, SchemaElementDecl> pair in sinfo.elementDecls)
     {
         if (!this.elementDecls.ContainsKey(pair.Key))
         {
             this.elementDecls.Add(pair.Key, pair.Value);
         }
     }
     foreach (KeyValuePair<XmlQualifiedName, SchemaElementDecl> pair2 in sinfo.elementDeclsByType)
     {
         if (!this.elementDeclsByType.ContainsKey(pair2.Key))
         {
             this.elementDeclsByType.Add(pair2.Key, pair2.Value);
         }
     }
     foreach (SchemaAttDef def in sinfo.AttributeDecls.Values)
     {
         if (!this.attributeDecls.ContainsKey(def.Name))
         {
             this.attributeDecls.Add(def.Name, def);
         }
     }
     foreach (SchemaNotation notation in sinfo.Notations.Values)
     {
         if (!this.Notations.ContainsKey(notation.Name.Name))
         {
             this.Notations.Add(notation.Name.Name, notation);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:50,代码来源:SchemaInfo.cs

示例11: XdrBuilder

 internal XdrBuilder(XmlReader reader, XmlNamespaceManager curmgr, SchemaInfo sinfo, string targetNamspace, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventhandler)
 {
     this._SchemaInfo = sinfo;
     this._TargetNamespace = targetNamspace;
     this._reader = reader;
     this._CurNsMgr = curmgr;
     this.validationEventHandler = eventhandler;
     this._StateHistory = new HWStack(10);
     this._ElementDef = new ElementContent();
     this._AttributeDef = new AttributeContent();
     this._GroupStack = new HWStack(10);
     this._GroupDef = new GroupContent();
     this._NameTable = nameTable;
     this._SchemaNames = schemaNames;
     this._CurState = S_SchemaEntries[0];
     this.positionInfo = PositionInfo.GetPositionInfo(this._reader);
     this.xmlResolver = new XmlUrlResolver();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:18,代码来源:XdrBuilder.cs

示例12: AddCompiledInfo

 internal void AddCompiledInfo(SchemaInfo schemaInfo)
 {
     XmlQualifiedName qualifiedName;
     foreach (XmlSchemaElement element in this.elements.Values)
     {
         qualifiedName = element.QualifiedName;
         schemaInfo.TargetNamespaces[qualifiedName.Namespace] = true;
         if (schemaInfo.ElementDecls[qualifiedName] == null)
         {
             schemaInfo.ElementDecls.Add(qualifiedName, element.ElementDecl);
         }
     }
     foreach (XmlSchemaAttribute attribute in this.attributes.Values)
     {
         qualifiedName = attribute.QualifiedName;
         schemaInfo.TargetNamespaces[qualifiedName.Namespace] = true;
         if (schemaInfo.ElementDecls[qualifiedName] == null)
         {
             schemaInfo.AttributeDecls.Add(qualifiedName, attribute.AttDef);
         }
     }
     foreach (XmlSchemaType type in this.types.Values)
     {
         qualifiedName = type.QualifiedName;
         schemaInfo.TargetNamespaces[qualifiedName.Namespace] = true;
         if ((!(type is XmlSchemaComplexType) || (type != XmlSchemaComplexType.AnyType)) && (schemaInfo.ElementDeclsByType[qualifiedName] == null))
         {
             schemaInfo.ElementDeclsByType.Add(qualifiedName, type.ElementDecl);
         }
     }
     foreach (XmlSchemaNotation notation in this.notations.Values)
     {
         qualifiedName = notation.QualifiedName;
         schemaInfo.TargetNamespaces[qualifiedName.Namespace] = true;
         SchemaNotation notation2 = new SchemaNotation(qualifiedName) {
             SystemLiteral = notation.System,
             Pubid = notation.Public
         };
         if (schemaInfo.Notations[qualifiedName.Name] == null)
         {
             schemaInfo.Notations.Add(qualifiedName.Name, notation2);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:44,代码来源:XmlSchema.cs

示例13: CheckDefaultValue

 public static void CheckDefaultValue(SchemaAttDef attdef, SchemaInfo sinfo, IValidationEventHandling eventHandling, string baseUriStr)
 {
     try
     {
         if (baseUriStr == null)
         {
             baseUriStr = string.Empty;
         }
         XmlSchemaDatatype datatype = attdef.Datatype;
         if (datatype != null)
         {
             object defaultValueTyped = attdef.DefaultValueTyped;
             XmlTokenizedType tokenizedType = datatype.TokenizedType;
             if (tokenizedType == XmlTokenizedType.ENTITY)
             {
                 if (datatype.Variety == XmlSchemaDatatypeVariety.List)
                 {
                     string[] strArray = (string[]) defaultValueTyped;
                     for (int i = 0; i < strArray.Length; i++)
                     {
                         BaseValidator.ProcessEntity(sinfo, strArray[i], eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
                     }
                 }
                 else
                 {
                     BaseValidator.ProcessEntity(sinfo, (string) defaultValueTyped, eventHandling, baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
                 }
             }
             else if (((tokenizedType == XmlTokenizedType.ENUMERATION) && !attdef.CheckEnumeration(defaultValueTyped)) && (eventHandling != null))
             {
                 XmlSchemaException exception = new XmlSchemaException("Sch_EnumerationValue", defaultValueTyped.ToString(), baseUriStr, attdef.ValueLineNumber, attdef.ValueLinePosition);
                 eventHandling.SendEvent(exception, XmlSeverityType.Error);
             }
         }
     }
     catch (Exception)
     {
         if (eventHandling != null)
         {
             XmlSchemaException exception2 = new XmlSchemaException("Sch_AttributeDefaultDataType", attdef.Name.ToString());
             eventHandling.SendEvent(exception2, XmlSeverityType.Error);
         }
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:44,代码来源:DtdValidator.cs

示例14: Validator

        internal Validator(XmlNameTable nameTable, SchemaNames schemaNames, XmlValidatingReader reader) {
            this.nameTable = nameTable;
            this.schemaNames = schemaNames;
            this.reader = reader;
            positionInfo = PositionInfo.GetPositionInfo(reader);
            nsManager = reader.NamespaceManager;
            if (nsManager == null) {
                nsManager = new XmlNamespaceManager(nameTable);
                isProcessContents = true;
            }
            SchemaInfo = new SchemaInfo(schemaNames);

            validationStack = new HWStack(STACK_INCREMENT);
            textValue = new StringBuilder();
            this.name = XmlQualifiedName.Empty;
            attPresence = new Hashtable();
            context = null;
            attnDef = null;
        }
开发者ID:ArildF,项目名称:masters,代码行数:19,代码来源:validator.cs

示例15: XmlSchemaSet

 public XmlSchemaSet(XmlNameTable nameTable)
 {
     if (nameTable == null)
     {
         throw new ArgumentNullException("nameTable");
     }
     this.nameTable = nameTable;
     this.schemas = new SortedList();
     this.schemaLocations = new Hashtable();
     this.chameleonSchemas = new Hashtable();
     this.targetNamespaces = new Hashtable();
     this.internalEventHandler = new System.Xml.Schema.ValidationEventHandler(this.InternalValidationCallback);
     this.eventHandler = this.internalEventHandler;
     this.readerSettings = new XmlReaderSettings();
     this.readerSettings.NameTable = nameTable;
     this.readerSettings.DtdProcessing = DtdProcessing.Prohibit;
     this.compilationSettings = new XmlSchemaCompilationSettings();
     this.cachedCompiledInfo = new SchemaInfo();
     this.compileAll = true;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:20,代码来源:XmlSchemaSet.cs


注:本文中的System.Xml.Schema.SchemaInfo类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。