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


C# XmlReader.Close方法代码示例

本文整理汇总了C#中System.Xml.XmlReader.Close方法的典型用法代码示例。如果您正苦于以下问题:C# XmlReader.Close方法的具体用法?C# XmlReader.Close怎么用?C# XmlReader.Close使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Xml.XmlReader的用法示例。


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

示例1: expandNamespace_namespace

 private void expandNamespace_namespace(TreeNodeCollection outNodes, TreeNode outInstanceMethods, string strSection, string strNamespace, XmlReader reader)
 {
     bool bContinue = reader.ReadToDescendant("namespace");
     while (bContinue)
     {
         if (reader.GetAttribute("name") == strNamespace)
         {
             expandNamespace_function(outNodes, outInstanceMethods, strSection, strNamespace, reader.ReadSubtree());
             reader.Close();
             return;
         }
         bContinue = ReadToNextSibling(reader, "namespace");
     }
     reader.Close();
 }
开发者ID:downpoured,项目名称:lnzscript,代码行数:15,代码来源:DocumentationFromLnzXml.cs

示例2: expandNamespace_function

        private void expandNamespace_function(TreeNodeCollection outNodes, TreeNode outInstanceMethods, string strSection, string strNamespace, XmlReader reader)
        {
            bool bContinue = reader.ReadToDescendant("function");
            while (bContinue)
            {

               // if (reader.GetAttribute("args") != null) MessageBox.Show("instance?");

                NodeDocLnzFunction node = new NodeDocLnzFunction(strSection, strNamespace, reader.GetAttribute("name"));

                bool bInstance = reader.GetAttribute("instance") == "true";
                node.bIsInstanceMethod = bInstance;
                string strArgs = reader.GetAttribute("args"); if (strArgs != null && strArgs != "") node.strArguments = strArgs;
                string strReturns = reader.GetAttribute("returns"); if (strReturns != null && strReturns != "") node.strReturns = strReturns;
                node.strDocumentationAndExample = getFunctionDocAndExample(reader.ReadSubtree()); //assumes doc before example

                if (bInstance)
                {
                    //MessageBox.Show("instance found");
                    outInstanceMethods.Nodes.Add(node);
                }
                else
                    outNodes.Add(node);

                bContinue = ReadToNextSibling(reader, "function");
            }
            reader.Close();
        }
开发者ID:downpoured,项目名称:lnzscript,代码行数:28,代码来源:DocumentationFromLnzXml.cs

示例3: expandNamespace_function

        private void expandNamespace_function(TreeNodeCollection outNodes, string strSection, string strNamespace, XmlReader reader)
        {
            bool bContinue = reader.ReadToDescendant("function");
            while (bContinue)
            {
                NodeDocPythonFunction node = newnode(strSection, strNamespace, reader.GetAttribute("name"));
                outNodes.Add(node);

                bool bInstance = reader.GetAttribute("instance") == "true";
                node.bIsInstanceMethod = bInstance;
                string strSyntax = reader.GetAttribute("fullsyntax"); if (strSyntax != null && strSyntax != "") node.strFullSyntax = strSyntax;
                node.strDocumentation = getFunctionDocAndExample(reader.ReadSubtree()); //assumes doc before example

                if (this.emphasizeStaticness())
                {
                    if (!bInstance)
                    {
                        //change visible node text to emphasize static-ness
                        node.Text = node.strNamespacename + "." + node.strFunctionname;
                    }
                }
                bContinue = ReadToNextSibling(reader, "function");
            }

            reader.Close();
        }
开发者ID:downpoured,项目名称:lnzscript,代码行数:26,代码来源:DocumentationFromPythonXml.cs

示例4: Task1

 public string Task1()
 {
     reader = XmlReader.Create(FILE_NAME);
     decimal in_v = 0;
     decimal out_v = 0;
     while (reader.Read())
     {
         if (reader.IsStartElement())
         {
             switch (reader.Name)
             {
                 case IN_V:
                     if(reader.Read())
                         in_v += Convert.ToDecimal(reader.Value.Trim());
                     break;
                 case OUT_V:
                     if (reader.Read())
                         out_v += Convert.ToDecimal(reader.Value.Trim());
                     break;
             }
         }
     }
     reader.Close();
     return IN_V + in_v.ToString() + "\n" + OUT_V + out_v.ToString();
 }
开发者ID:ErikCH,项目名称:XMLAssignment,代码行数:25,代码来源:Business.cs

示例5: ReadXmlSerializable

 private static void ReadXmlSerializable(DataTable dt, XmlReader xr)
 {
     XmlSerializer serializer = new XmlSerializer(dt.GetType());
     IXmlSerializable idt = dt;
     idt.ReadXml(xr);
     xr.Close();
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:DataTableTest5.cs

示例6: ReadResults

		void ReadResults(XmlReader reader)
		{
			CodeCoverageModule currentModule = null;
			CodeCoverageMethod currentMethod = null;
			string currentClassName = String.Empty;
			
			while (reader.Read()) {
				switch (reader.NodeType) {
					case XmlNodeType.Element:
						if (reader.Name == "Type") {
							currentModule = AddModule(reader);
							currentClassName = reader.GetAttribute("name");
						} else if ((reader.Name == "Method") && (currentModule != null)) {
							currentMethod = AddMethod(currentModule, currentClassName, reader);
						} else if ((reader.Name == "pt") && (currentMethod != null)) {
							AddSequencePoint(currentMethod, reader);
						} else if (reader.Name == "File") {
							AddFileName(reader);
						} else if (reader.Name == "Assembly") {
							AddAssembly(reader);
						}
						break;
				}
			}
			reader.Close();
		}
开发者ID:Bombadil77,项目名称:SharpDevelop,代码行数:26,代码来源:CodeCoverageResults.cs

示例7: Disc

 internal Disc (XmlReader reader)
 {
     reader.Read ();
     int.TryParse (reader ["sectors"], out sectors);
     id = reader ["id"];
     reader.Close ();
 }
开发者ID:androidhacker,项目名称:DotNetProjs,代码行数:7,代码来源:Disc.cs

示例8: DataHandler

        XDocument settings; //xml settings document

        #endregion Fields

        #region Constructors

        public DataHandler()
        {
            //instantiate lists
            history = new History();
            bookmarks = new Bookmarks();

            //set path to user.home
            path = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + "\\settings.xml";

            //Read xml from user home, if no document exist, skip
            try
            {
                reader = XmlTextReader.Create(@path);
                settings = XDocument.Load(reader);
                //create objects and lists from xml
                loadBookmarks();
                loadHistory();
                loadHomePage();
                reader.Close();
            }
            catch (FileNotFoundException)
            {
                //skip this step
            }
        }
开发者ID:geekscruff,项目名称:m3app2_final,代码行数:31,代码来源:DataHandler.cs

示例9: updateLastPost

 private void updateLastPost()
 {
     reader = XmlReader.Create(URL);
     SyndicationFeed feed = SyndicationFeed.Load(reader);
     reader.Close();
     lastPost = feed.Items.First();
 }
开发者ID:ErinvanderVeen,项目名称:Reddit-RSS-Bot,代码行数:7,代码来源:RSSFeed.cs

示例10: ReadResults

		void ReadResults(XmlReader reader)
		{
			CodeCoverageModule currentModule = null;
			CodeCoverageMethod currentMethod = null;
			string currentClassName = String.Empty;
			
			while (reader.Read()) {
				switch (reader.NodeType) {
					case XmlNodeType.Element:
						if (reader.Name == "Type") {
							currentModule = AddModule(reader);
							currentClassName = reader.GetAttribute("name");
						} else if ((reader.Name == "Method") && (currentModule != null) && (!reader.IsEmptyElement)) {
							currentMethod = AddMethod(currentModule, currentClassName, reader);
						} else if ((reader.Name == "pt") && (currentMethod != null)) {
							AddSequencePoint(currentMethod, reader);
						} else if (reader.Name == "File") {
							AddFileName(reader);
						} else if (reader.Name == "Assembly") {
							AddAssembly(reader);
						}
						break;
					case XmlNodeType.EndElement:
						if (currentMethod != null && reader.Name == "Method" && currentMethod.SequencePoints.Count == 0) {
							// Remove method that has no sequence points.
							currentModule.Methods.Remove(currentMethod);
						}
						break;
				}
			}
			reader.Close();
			
			RemoveModulesWithNoMethods();
		}
开发者ID:kingjiang,项目名称:SharpDevelopLite,代码行数:34,代码来源:CodeCoverageResults.cs

示例11: Load

        public bool Load(string FileName)
        {
            if (!File.Exists(FileName)) return false;
            if ((new FileInfo(FileName).Length) == 0)
            {
                File.Delete(FileName);
                return false;
            }

            F = XmlReader.Create(FileName);

            try
            {
                F.MoveToContent();
            }
            catch (Exception)
            {
                F.Close();

                File.Delete(FileName);
                return false;
            }

            return true;
        }
开发者ID:nwalker,项目名称:tenhouviewer,代码行数:25,代码来源:XmlLoad.cs

示例12: ReadOuterXml

 private string ReadOuterXml(XmlReader forReader) {
     try {
         forReader.MoveToContent();
         return forReader.ReadOuterXml();
     } finally {
         forReader.Close();
     }
 }
开发者ID:gsbastian,项目名称:Sriracha.Deploy,代码行数:8,代码来源:XmlInputTests.cs

示例13: DeSerializeObject

        /// <summary>
        ///     Serializes an object instance to a file.
        /// </summary>
        /// <param name="instance">the object instance to serialize</param>
        /// <param name="resultBuffer">The result buffer.</param>
        /// <param name="throwExceptions">if set to <c>true</c> [throw exceptions].</param>
        /// <returns></returns>
        /// <summary>
        ///     Serializes an object to an XML string. Unlike the other SerializeObject overloads
        ///     this methods *returns a string* rather than a bool result!
        /// </summary>
        /// <param name="instance"></param>
        /// <param name="throwExceptions">Determines if a failure throws or returns null</param>
        /// <returns>
        ///     null on error otherwise the Xml String.
        /// </returns>
        /// <remarks>
        ///     If null is passed in null is also returned so you might want
        ///     to check for null before calling this method.
        /// </remarks>
        /// <summary>
        ///     Deserializes an object from file and returns a reference.
        /// </summary>
        /// <param name="fileName">name of the file to serialize to</param>
        /// <param name="objectType">The Type of the object. Use typeof(yourobject class)</param>
        /// <param name="binarySerialization">determines whether we use Xml or Binary serialization</param>
        /// <returns>Instance of the deserialized object or null. Must be cast to your object type</returns>
        /// <summary>
        ///     Deserializes an object from file and returns a reference.
        /// </summary>
        /// <param name="fileName">name of the file to serialize to</param>
        /// <param name="objectType">The Type of the object. Use typeof(yourobject class)</param>
        /// <param name="binarySerialization">determines whether we use Xml or Binary serialization</param>
        /// <param name="throwExceptions">determines whether failure will throw rather than return null on failure</param>
        /// <returns>Instance of the deserialized object or null. Must be cast to your object type</returns>
        /// <summary>
        ///     Deserialize an object from an XmlReader object.
        /// </summary>
        /// <param name="reader"></param>
        /// <param name="objectType"></param>
        /// <returns></returns>
        public static object DeSerializeObject(XmlReader reader, Type objectType)
        {
            var serializer = new XmlSerializer(objectType);
            var instance = serializer.Deserialize(reader);
            reader.Close();

            return instance;
        }
开发者ID:vip32,项目名称:Xtricate,代码行数:49,代码来源:SerializationHelper.cs

示例14: DeserializePropertyElement

 protected override void DeserializePropertyElement(XmlReader reader)
 {
     if (reader.Name.ToLower () == "optional") {
         optional = true;
         reader.Close ();
     } else {
         base.DeserializePropertyElement (reader);
     }
 }
开发者ID:MustafaUzumcuCom,项目名称:mono-upnp,代码行数:9,代码来源:OfflineAction.cs

示例15: Compile

        /// <exclude />
        public void Compile(XmlReader reader, IFormChannelIdentifier channel,
                            Dictionary<string, object> bindingObjects, bool withDebug, string customControlIdPrefix,
                            Dictionary<string, List<ClientValidationRule>> bindingsValidationRules)
        {
            XDocument doc = XDocument.Load(reader);
            reader.Close();

            Compile(doc, channel, bindingObjects, withDebug, customControlIdPrefix, bindingsValidationRules);
        }
开发者ID:DBailey635,项目名称:C1-CMS,代码行数:10,代码来源:FormTreeCompiler.cs


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