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


C# Xml.XmlResolver类代码示例

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


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


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