• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Xml.XmlResolver类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: LoadXslt

        /// <summary>
        /// Loads the XSLT file using specified path, settings and stylesheet resolver.
        /// </summary>
        /// <param name="path">The URL to the XSLT file.</param>
        /// <param name="settings">XSLT settings.</param>
        /// <param name="stylesheetResolver">The stylesheet resolver.</param>
        /// <returns><see cref="XslCompiledTransform" /> object that can transform the input.</returns>
        public virtual XslCompiledTransform LoadXslt(string path, XsltSettings settings, XmlResolver stylesheetResolver)
        {
            var xslt = new XslCompiledTransform();
            xslt.Load(path, settings, stylesheetResolver);

            return xslt;
        }
开发者ID:whyleee,项目名称:EPiTranslator-old,代码行数:14,代码来源:XmlHelper.cs


示例2: RecurseNode

		private void RecurseNode(XmlDocument doc, XmlResolver resolver, XmlNode elementNode, string xsltName)
		{
			this.ElementToHTMLPage(doc,resolver,elementNode,xsltName);

			foreach(XmlNode childNode in elementNode)
			{
				if(childNode.Name == "Glossary")
				{
					this.ElementToHTMLPage(doc,resolver,childNode,"Glossary.xsl");
				}
				if(childNode.Name == "Packages")
				{
					foreach(XmlNode packageNode in childNode.ChildNodes)
					{
						this.RecurseNode(doc,resolver,packageNode,"Package.xsl");
					}
				}
				if(childNode.Name == "Actors")
				{
					foreach(XmlNode actorNode in childNode.ChildNodes)
					{
						this.RecurseNode(doc,resolver,actorNode,"Actor.xsl");
					}
				}
				if(childNode.Name == "UseCases")
				{
					foreach(XmlNode useCaseNode in childNode.ChildNodes)
					{
						this.RecurseNode(doc,resolver,useCaseNode,"UseCase.xsl");
					}
				}
			}
		}
开发者ID:xuchuansheng,项目名称:GenXSource,代码行数:33,代码来源:HTMLConverter.cs


示例3: InitWriter

		/// <summary>
		/// Initializes the writer to write redirected output. 
		/// </summary>              
		/// <remarks>Depending on the <c>method</c> attribute value, 
		/// <c>XmlTextWriter</c> or <c>StreamWriter</c> is created. 
		/// <c>XmlTextWriter</c> is used for outputting XML and  
		/// <c>StreamWriter</c> - for plain text.
		/// </remarks>
		public void InitWriter(XmlResolver outResolver)
		{
			if (outResolver == null)
			{
				outResolver = new OutputResolver(Directory.GetCurrentDirectory());
			}
			// Save current directory
			//storedDir = Directory.GetCurrentDirectory();
			string outFile = outResolver.ResolveUri(null, href).LocalPath;
			DirectoryInfo dir = Directory.GetParent(outFile);
			if (!dir.Exists)
				dir.Create();
			// Create writer
			if (method == OutputMethod.Xml)
			{
				xmlWriter = new XmlTextWriter(outFile, encoding);
				if (indent)
					xmlWriter.Formatting = Formatting.Indented;
				if (!omitXmlDecl)
				{
					if (standalone)
						xmlWriter.WriteStartDocument(true);
					else
						xmlWriter.WriteStartDocument();
				}
			}
			else
				textWriter = new StreamWriter(outFile, false, encoding);
			// Set new current directory            
			//Directory.SetCurrentDirectory(dir.ToString());                                    
            href = ""; // clean the href for the next usage
		}
开发者ID:zanyants,项目名称:mvp.xml,代码行数:40,代码来源:OutputState.cs


示例4: CompileToType

 public static CompilerErrorCollection CompileToType(XmlReader stylesheet, XsltSettings settings, XmlResolver stylesheetResolver, bool debug, TypeBuilder typeBuilder, string scriptAssemblyPath)
 {
     QilExpression expression;
     if (stylesheet == null)
     {
         throw new ArgumentNullException("stylesheet");
     }
     if (typeBuilder == null)
     {
         throw new ArgumentNullException("typeBuilder");
     }
     if (settings == null)
     {
         settings = XsltSettings.Default;
     }
     if (settings.EnableScript && (scriptAssemblyPath == null))
     {
         throw new ArgumentNullException("scriptAssemblyPath");
     }
     if (scriptAssemblyPath != null)
     {
         scriptAssemblyPath = Path.GetFullPath(scriptAssemblyPath);
     }
     CompilerErrorCollection errors = new Compiler(settings, debug, scriptAssemblyPath).Compile(stylesheet, stylesheetResolver, out expression).Errors;
     if (!errors.HasErrors)
     {
         if (GeneratedCodeCtor == null)
         {
             GeneratedCodeCtor = typeof(GeneratedCodeAttribute).GetConstructor(new Type[] { typeof(string), typeof(string) });
         }
         typeBuilder.SetCustomAttribute(new CustomAttributeBuilder(GeneratedCodeCtor, new object[] { typeof(XslCompiledTransform).FullName, "4.0.0.0" }));
         new XmlILGenerator().Generate(expression, typeBuilder);
     }
     return errors;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:35,代码来源:XslCompiledTransform.cs


示例5: XmlQueryContext

        internal XmlQueryContext(XmlQueryRuntime runtime, object defaultDataSource, XmlResolver dataSources, XsltArgumentList argList, WhitespaceRuleLookup wsRules) {
            this.runtime = runtime;
            this.dataSources = dataSources;
            this.dataSourceCache = new Hashtable();
            this.argList = argList;
            this.wsRules = wsRules;

            if (defaultDataSource is XmlReader) {
                this.readerSettings = new QueryReaderSettings((XmlReader) defaultDataSource);
            }
            else {
                // Consider allowing users to set DefaultReaderSettings in XsltArgumentList
                // readerSettings = argList.DefaultReaderSettings;
                this.readerSettings = new QueryReaderSettings(new NameTable());
            }

            if (defaultDataSource is string) {
                // Load the default document from a Uri
                this.defaultDataSource = GetDataSource(defaultDataSource as string, null);

                if (this.defaultDataSource == null)
                    throw new XslTransformException(Res.XmlIl_UnknownDocument, defaultDataSource as string);
            }
            else if (defaultDataSource != null) {
                this.defaultDataSource = ConstructDocument(defaultDataSource, null, null);
            }
        }
开发者ID:uQr,项目名称:referencesource,代码行数:27,代码来源:XmlQueryContext.cs


示例6: XmlTransformingReader

 /// <summary>
 /// Creates XmlTransformingReader with given XmlReader, stylesheet URI, 
 /// XsltArgumentList and Xmlresolver.
 /// </summary>
 /// <param name="parentReader">Source XML as XmlReader</param>
 /// <param name="transformSource">URI of the stylesheet to transform the source</param>
 /// <param name="args">Arguments to the transformation</param>
 /// <param name="resolver">XmlResolver to resolve URIs in document() function</param>
 public XmlTransformingReader(XmlReader parentReader, 
   string transformSource, XsltArgumentList args, XmlResolver resolver) 
 {			
   XPathDocument doc = new XPathDocument(parentReader);
   XslTransform xslt = new XslTransform();
   xslt.Load(transformSource);
   _outReader = xslt.Transform(doc, args, resolver);
 }
开发者ID:zanyants,项目名称:mvp.xml,代码行数:16,代码来源:XmlTransformingReader.cs


示例7: NvdlValidatingReader

		public NvdlValidatingReader (XmlReader reader, NvdlRules rules,
			XmlResolver resolver, NvdlConfig config)
			: base (reader)
		{
			dispatcher = new NvdlDispatcher (new SimpleRules (
				new NvdlCompileContext (
				rules, config, resolver)), this);
		}
开发者ID:jack-pappas,项目名称:mono,代码行数:8,代码来源:NvdlValidatingReader.cs


示例8: Execute

 private void Execute(object defaultDocument, XmlResolver dataSources, XsltArgumentList argumentList, XmlSequenceWriter results)
 {
     if (dataSources == null)
     {
         dataSources = XmlNullResolver.Singleton;
     }
     this.delExec(new XmlQueryRuntime(this.staticData, defaultDocument, dataSources, argumentList, results));
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:XmlILCommand.cs


示例9: XmlSecureResolver

		public XmlSecureResolver (
			XmlResolver resolver, Evidence evidence)
		{
			this.resolver = resolver;
			if (SecurityManager.SecurityEnabled) {
				this.permissionSet = SecurityManager.ResolvePolicy (evidence);
			}
		}
开发者ID:nobled,项目名称:mono,代码行数:8,代码来源:XmlSecureResolver.cs


示例10: CanonicalXml

        internal CanonicalXml(XmlDocument document, XmlResolver resolver, bool includeComments) {
            if (document == null)
                throw new ArgumentNullException("document");

            m_c14nDoc = new CanonicalXmlDocument(true, includeComments);
            m_c14nDoc.XmlResolver = resolver;
            m_c14nDoc.Load(new XmlNodeReader(document));
            m_ancMgr = new C14NAncestralNamespaceContextManager();
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:CanonicalXml.cs


示例11: TransformToDocument

 internal static XmlDocument TransformToDocument( XmlReader input, XslCompiledTransform transform, XsltArgumentList args, XmlResolver resolver )
 {
     XmlDocument doc = new XmlDocument( );
     using( XmlWriter output = doc.CreateNavigator().AppendChild() )
     {
         transform.Transform( input, args, output, resolver );
     }
     return doc;
 }
开发者ID:derrills1,项目名称:ccnet_gitmode,代码行数:9,代码来源:Utils.cs


示例12: ExcCanonicalXml

        internal ExcCanonicalXml(Stream inputStream, bool includeComments, string inclusiveNamespacesPrefixList, XmlResolver resolver, string strBaseUri) {
            if (inputStream == null)
                throw new ArgumentNullException("inputStream");

            m_c14nDoc = new CanonicalXmlDocument(true, includeComments);
            m_c14nDoc.XmlResolver = resolver;
            m_c14nDoc.Load(Utils.PreProcessStreamInput(inputStream, resolver, strBaseUri));
            m_ancMgr = new ExcAncestralNamespaceContextManager(inclusiveNamespacesPrefixList);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:9,代码来源:ExcCanonicalXml.cs


示例13: XmlOutput

    	internal XmlOutput(XslTransform transform, XsltArgumentList xsltArgs, 
						   XPathNavigator navigator, XmlResolver resolverForXmlTransformed,
						   XmlReader[] readersToClose) {
			_transform = transform;
			_xsltArgs = xsltArgs;
			_navigator = navigator;
			_resolverForXmlTransformed = resolverForXmlTransformed;
			_readersToClose = readersToClose;
		}
开发者ID:timonela,项目名称:mb-unit,代码行数:9,代码来源:XmlOutput.cs


示例14: ReadXml

        public void ReadXml(XPathNavigator node, XmlResolver resolver)
        {
            if (node.NodeType == XPathNodeType.Element) {

            if (node.MoveToFirstAttribute()) {
               do {
                  switch (node.LocalName) {
                     case "media-type":
                        this.MediaType = node.Value;
                        break;

                     case "boundary":
                        this.Boundary = node.Value;
                        break;
                  }
               } while (node.MoveToNextAttribute());

               node.MoveToParent();
            }

            if (node.MoveToChild(XPathNodeType.Element)) {

               XPathHttpMultipartItem currentItem = null;

               do {
                  if (node.NamespaceURI == XPathHttpClient.Namespace) {

                     switch (node.LocalName) {
                        case "header":
                           if (currentItem == null) {
                              currentItem = new XPathHttpMultipartItem();
                           }

                           currentItem.Headers.Add(node.GetAttribute("name", ""), node.GetAttribute("value", ""));
                           break;

                        case "body":
                           if (currentItem == null) {
                              currentItem = new XPathHttpMultipartItem();
                           }

                           currentItem.Body = new XPathHttpBody();
                           currentItem.Body.ReadXml(node, resolver);

                           this.Items.Add(currentItem);
                           currentItem = null;
                           break;
                     }
                  }

               } while (node.MoveToNext(XPathNodeType.Element));

               node.MoveToParent();
            }
             }
        }
开发者ID:skurdiukov,项目名称:myxsl,代码行数:56,代码来源:XPathHttpMultipart.cs


示例15: CreateValidator

		public override XmlReader CreateValidator (XmlReader reader,
			XmlResolver resolver)
		{
			// XmlResolver is never used.
			RelaxngValidatingReader rvr = 
				new RelaxngValidatingReader (
					reader, pattern);
			rvr.ReportDetails = true;
			return rvr;
		}
开发者ID:jack-pappas,项目名称:mono,代码行数:10,代码来源:NvdlRelaxngSupport.cs


示例16: LoadFromPath

 /// <summary>
 /// This should be a part of the I/O layer
 /// </summary>
 public static void LoadFromPath(this XslCompiledTransform xslCompiledTransform, string path, XsltSettings settings, XmlResolver stylesheetResolver)
 {
     using (C1StreamReader streamReader = new C1StreamReader(path))
     {
         using (XmlReader xmlReader = XmlReader.Create(streamReader))
         {
             xslCompiledTransform.Load(xmlReader, settings, stylesheetResolver);
         }
     }
 }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:13,代码来源:XslCompiledTransformUtils.cs


示例17: CanonicalXml

 internal CanonicalXml(Stream inputStream, bool includeComments, XmlResolver resolver, string strBaseUri)
 {
     if (inputStream == null)
     {
         throw new ArgumentNullException("inputStream");
     }
     this.m_c14nDoc = new CanonicalXmlDocument(true, includeComments);
     this.m_c14nDoc.XmlResolver = resolver;
     this.m_c14nDoc.Load(System.Security.Cryptography.Xml.Utils.PreProcessStreamInput(inputStream, resolver, strBaseUri));
     this.m_ancMgr = new C14NAncestralNamespaceContextManager();
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:11,代码来源:CanonicalXml.cs


示例18: CreateValidatingReader

		/// <summary>
		/// Gets an appropriate <see cref="System.Xml.XmlReader"/> implementation
		/// for the supplied <see cref="System.IO.Stream"/>.
		/// </summary>
		/// <param name="stream">The XML <see cref="System.IO.Stream"/> that is going to be read.</param>
		/// <param name="xmlResolver"><see cref="XmlResolver"/> to be used for resolving external references</param>
		/// <param name="schemas">XML schemas that should be used for validation.</param>
		/// <param name="eventHandler">Validation event handler.</param>
		/// <returns>
		/// A validating <see cref="System.Xml.XmlReader"/> implementation.
		/// </returns>
		public static XmlReader CreateValidatingReader(Stream stream, XmlResolver xmlResolver, XmlSchemaCollection schemas, ValidationEventHandler eventHandler)
		{
			XmlValidatingReader reader = new XmlValidatingReader(new XmlTextReader(stream));
			reader.XmlResolver = xmlResolver;
			reader.Schemas.Add(schemas);
			reader.ValidationType = ValidationType.Schema;
			if (eventHandler != null)
			{
				reader.ValidationEventHandler += eventHandler;
			}
			return reader;
		}
开发者ID:fuadm,项目名称:spring-net,代码行数:23,代码来源:XmlUtils.cs


示例19: CreateValidator

		public override XmlReader CreateValidator (XmlReader reader,
			XmlResolver resolver)
		{
			XmlReaderSettings s = new XmlReaderSettings ();
			s.ValidationType = ValidationType.Schema;
			// do not allow inline schema and schemaLocation.
			s.ValidationFlags = XmlSchemaValidationFlags.ProcessIdentityConstraints;
			s.XmlResolver = resolver;
			foreach (XmlSchema schema in schemas)
				s.Schemas.Add (schema);
			return XmlReader.Create (reader, s);
		}
开发者ID:Profit0004,项目名称:mono,代码行数:12,代码来源:NvdlXsdSupport.cs


示例20: Transform

		protected Transform ()
		{
//			if (SecurityManager.SecurityEnabled) {
//				xmlResolver = new XmlSecureResolver (new XmlUrlResolver (), (Evidence) new Evidence ());
//			} else {
				xmlResolver = new XmlUrlResolver ();
//			}
		}
开发者ID:Xipas,项目名称:Symplified.Auth,代码行数:8,代码来源:Transform.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Xml.XmlText类代码示例发布时间:2022-05-27
下一篇:
C# Xml.XmlReaderSettings类代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap