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


C# XmlResolver类代码示例

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


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

示例1: Load

 public void Load(IXPathNavigable stylesheet, XmlResolver resolver)
 {
     if (stylesheet == null)
     {
         throw new ArgumentNullException(nameof(stylesheet));
     }
     Load(stylesheet.CreateNavigator(), resolver);
 }
开发者ID:alessandromontividiu03,项目名称:corefx,代码行数:8,代码来源:XslTransform.cs

示例2: XmlDTDParserInput

	// Initialize this dtd reader.
	public void Init
				(XmlParserInput input,
				 XmlResolver resolver)
			{
				base.ErrorHandler = input.ErrorHandler;
				this.input = new XmlDTDParserInput(input, context.NameTable);
				this.resolver = resolver;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:9,代码来源:XmlDTDReader.cs

示例3: Load

        public void Load(Compiler compiler, object stylesheet, XmlResolver xmlResolver)
        {
            Debug.Assert(compiler != null);
            _compiler = compiler;
            _xmlResolver = xmlResolver ?? XmlNullResolver.Singleton;

            XmlReader reader = stylesheet as XmlReader;
            if (reader != null)
            {
                _readerSettings = new QueryReaderSettings(reader);
                Load(reader);
            }
            else
            {
                // We should take DefaultReaderSettings from Compiler.Settings.DefaultReaderSettings.

                string uri = stylesheet as string;
                if (uri != null)
                {
                    // If xmlResolver == null, then the original uri will be resolved using XmlUrlResolver
                    XmlResolver origResolver = xmlResolver;
                    if (xmlResolver == null || xmlResolver == XmlNullResolver.Singleton)
                        origResolver = new XmlUrlResolver();
                    Uri resolvedUri = origResolver.ResolveUri(null, uri);
                    if (resolvedUri == null)
                    {
                        throw new XslLoadException(SR.Xslt_CantResolve, uri);
                    }

                    _readerSettings = new QueryReaderSettings(new NameTable());
                    using (reader = CreateReader(resolvedUri, origResolver))
                    {
                        Load(reader);
                    }
                }
                else
                {
                    IXPathNavigable navigable = stylesheet as IXPathNavigable;
                    if (navigable != null)
                    {
                        reader = XPathNavigatorReader.Create(navigable.CreateNavigator());
                        _readerSettings = new QueryReaderSettings(reader.NameTable);
                        Load(reader);
                    }
                    else
                    {
                        Debug.Fail("Should never get here");
                    }
                }
            }
            Debug.Assert(compiler.Root != null);
            compiler.StartApplyTemplates = f.ApplyTemplates(nullMode);
            ProcessOutputSettings();
            foreach (AttributeSet attSet in compiler.AttributeSets.Values)
            {
                CheckAttributeSetsDfs(attSet); // Check attribute sets for circular references using dfs marking method
            }
        }
开发者ID:dotnet,项目名称:corefx,代码行数:58,代码来源:XsltLoader.cs

示例4: Execute

        /// <summary>
        /// Default document as XPathNavigator.
        /// </summary>
        public override void Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlWriter results) {
            if (results == null)
                throw new ArgumentNullException(nameof(results));

            if (contextDocument != null)
                Execute(contextDocument.CreateNavigator(), dataSources, argumentList, results, false);
            else
                Execute(null, dataSources, argumentList, results, false);
        }
开发者ID:geoffkizer,项目名称:corefx,代码行数:12,代码来源:XmlILCommand.cs

示例5: Load

 public void Load(XPathNavigator stylesheet, XmlResolver resolver) {
     if (stylesheet == null) {
         throw new ArgumentNullException("stylesheet");
     }
     if (resolver == null) {
         resolver = new XmlNullResolver();
     }
     Compile(stylesheet, resolver, /*evidence:*/null);
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:9,代码来源:xsltransform.cs

示例6: Load

        public void Load(Compiler compiler, object stylesheet, XmlResolver xmlResolver) {
            Debug.Assert(compiler != null);
            this.compiler = compiler;
            this.xmlResolver = xmlResolver ?? XmlNullResolver.Singleton;

            XmlReader reader = stylesheet as XmlReader;
            if (reader != null) {
                readerSettings = new QueryReaderSettings(reader);
                LoadStylesheet(reader, /*include:*/false);
            } else {
                // We should take DefaultReaderSettings from Compiler.Settings.DefaultReaderSettings.

                string uri = stylesheet as string;
                if (uri != null) {
                    // If xmlResolver == null, then the original uri will be resolved using XmlUrlResolver
                    XmlResolver origResolver = xmlResolver ?? new XmlUrlResolver();
                    Uri resolvedUri = origResolver.ResolveUri(null, uri);
                    if (resolvedUri == null) {
                        throw new XslLoadException(Res.Xslt_CantResolve, uri);
                    }

                    readerSettings = new QueryReaderSettings(new NameTable());
                    using (reader = CreateReader(resolvedUri, origResolver)) {
                        LoadStylesheet(reader, /*include:*/false);
                    }
                } else {
                    IXPathNavigable navigable = stylesheet as IXPathNavigable;
                    if (navigable != null) {
                        reader = XPathNavigatorReader.Create(navigable.CreateNavigator());
                        readerSettings = new QueryReaderSettings(reader.NameTable);
                        LoadStylesheet(reader, /*include:*/false);
                    } else {
                        Debug.Fail("Should never get here");
                    }
                }
            }
            Process();
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:38,代码来源:xsltloader.cs

示例7: Validate

 internal XmlReader Validate(XmlReader reader, XmlResolver resolver, XmlSchemaSet schemaSet, ValidationEventHandler valEventHandler) {
     if (schemaSet != null) {
         XmlReaderSettings readerSettings = new XmlReaderSettings();
         readerSettings.ValidationType = ValidationType.Schema;
         readerSettings.Schemas = schemaSet;
         readerSettings.ValidationEventHandler += valEventHandler;                
         return new XsdValidatingReader(reader, resolver, readerSettings, this);
     }
     return null;
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:10,代码来源:XmlSchemaAttribute.cs

示例8: Evaluate

 /// <devdoc>
 ///     <para>
 ///         Executes the query by accessing datasources via the XmlResolver and using
 ///         run-time parameters as provided by the XsltArgumentList. The default document
 ///         is mapped into the XmlResolver with the provided name. The results are returned
 ///         as an IList.
 ///     </para>
 /// </devdoc>
 public abstract IList Evaluate(XmlReader contextDocument, XmlResolver dataSources, XsltArgumentList argumentList);
开发者ID:Corillian,项目名称:corefx,代码行数:9,代码来源:XmlCommand.cs

示例9: Execute

 /// <devdoc>
 ///     <para>
 ///         Executes the query over the provided XPathNavigator with the given XsltArgumentList
 ///         as run-time parameters. The results are output to the provided Stream.
 ///     </para>
 /// </devdoc>
 public abstract void Execute(IXPathNavigable contextDocument, XmlResolver dataSources, XsltArgumentList argumentList, Stream results);
开发者ID:Corillian,项目名称:corefx,代码行数:7,代码来源:XmlCommand.cs

示例10: Evaluate

 /// <summary>
 /// Executes the query by accessing datasources via the XmlResolver and using
 /// run-time parameters as provided by the XsltArgumentList. The default document
 /// is mapped into the XmlResolver with the provided name. The results are returned
 /// as an IList.
 /// </summary>
 public override IList Evaluate(XmlReader contextDocument, XmlResolver dataSources, XsltArgumentList argumentList) {
     XmlCachedSequenceWriter seqwrt = new XmlCachedSequenceWriter();
     Execute(contextDocument, dataSources, argumentList, seqwrt);
     return seqwrt.ResultSequence;
 }
开发者ID:geoffkizer,项目名称:corefx,代码行数:11,代码来源:XmlILCommand.cs

示例11: Add

        private XmlSchema Add(string ns, SchemaInfo schemaInfo, XmlSchema schema, bool compile, XmlResolver resolver) {
            int errorCount = 0;
            if (schema != null) {
                if (schema.ErrorCount == 0 && compile) {
					if (!schema.CompileSchema(this, resolver, schemaInfo, ns, validationEventHandler, nameTable, true)) {
						errorCount = 1;
					}
					ns = schema.TargetNamespace == null ? string.Empty : schema.TargetNamespace;
                }
				errorCount += schema.ErrorCount;
            } 
            else {
                errorCount += schemaInfo.ErrorCount;
                //ns = ns == null? string.Empty : NameTable.Add(ns);
                ns = NameTable.Add(ns); //Added without checking for ns == null, since XDR cannot have null namespace
            }
            if (errorCount == 0) {
                XmlSchemaCollectionNode node = new XmlSchemaCollectionNode();
                node.NamespaceURI = ns;
                node.SchemaInfo = schemaInfo; 
				node.Schema = schema; 
                Add(ns, node);
                return schema;
            }
            return null;
        }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:26,代码来源:xmlschemacollection.cs

示例12: XmlDTDReader

	// Constructor.
	public XmlDTDReader(XmlParserContext context)
			: base(null)
			{
				this.context = context;
				this.input = null;
				this.resolver = null;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:XmlDTDReader.cs

示例13: Parser

 public Parser(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler) {
     this.schemaType = schemaType;
     this.nameTable = nameTable;
     this.schemaNames = schemaNames;
     this.eventHandler = eventHandler;
     this.xmlResolver = System.Xml.XmlConfiguration.XmlReaderSection.CreateDefaultResolver();
     processMarkup = true;
     dummyDocument = new XmlDocument();
 }
开发者ID:uQr,项目名称:referencesource,代码行数:9,代码来源:Parser.cs

示例14: Parser

 public Parser(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler) {
     this.schemaType = schemaType;
     this.nameTable = nameTable;
     this.schemaNames = schemaNames;
     this.eventHandler = eventHandler;
     this.xmlResolver = new XmlUrlResolver();
     processMarkup = true;
     dummyDocument = new XmlDocument();
 }
开发者ID:gbarnett,项目名称:shared-source-cli-2.0,代码行数:9,代码来源:parser.cs

示例15: Parser

 public Parser(SchemaType schemaType, XmlNameTable nameTable, SchemaNames schemaNames, ValidationEventHandler eventHandler)
 {
     _schemaType = schemaType;
     _nameTable = nameTable;
     _schemaNames = schemaNames;
     _eventHandler = eventHandler;
     _xmlResolver = null;
     _processMarkup = true;
     _dummyDocument = new XmlDocument();
 }
开发者ID:dotnet,项目名称:corefx,代码行数:10,代码来源:Parser.cs


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