當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。