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

C# Xml.XmlNodeReader类代码示例

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

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



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

示例1: WMIBMySQL

 public WMIBMySQL()
 {
     string file = Variables.ConfigurationDirectory + Path.DirectorySeparatorChar + "unwrittensql.xml";
     Core.RecoverFile(file);
     if (File.Exists(file))
     {
         Syslog.WarningLog("There is a mysql dump file from previous run containing mysql rows that were never successfuly inserted, trying to recover them");
         XmlDocument document = new XmlDocument();
         using (TextReader sr = new StreamReader(file))
         {
             document.Load(sr);
             using (XmlNodeReader reader = new XmlNodeReader(document.DocumentElement))
             {
                 XmlSerializer xs = new XmlSerializer(typeof(Unwritten));
                 Unwritten un = (Unwritten)xs.Deserialize(reader);
                 lock (unwritten.PendingRows)
                 {
                     unwritten.PendingRows.AddRange(un.PendingRows);
                 }
             }
         }
     }
     Thread reco = new Thread(Exec) {Name = "MySQL/Recovery"};
     Core.ThreadManager.RegisterThread(reco);
     reco.Start();
 }
开发者ID:benapetr,项目名称:wikimedia-bot,代码行数:26,代码来源:MySQL.cs


示例2: Create

        public static EvaluationEngine Create(XmlDocument policyDoc, IXacmlPolicyRepository ch) {
            Contract.Requires<ArgumentNullException>(policyDoc != null);

            using (XmlReader reader = new XmlNodeReader(policyDoc.DocumentElement)) {
                return EvaluationEngineFactory.Create(reader, ch);
            }
        }
开发者ID:abc-software,项目名称:abc.xacml,代码行数:7,代码来源:EvaluationEngineFactory.cs


示例3: RetargetWithMetadataConverter

        /// <remarks>Internal for testing.</remarks>
        internal static void RetargetWithMetadataConverter(XDocument xdoc, Version targetSchemaVersion, MetadataConverterDriver converter)
        {
            Debug.Assert(xdoc != null, "xdoc != null");
            Debug.Assert(EntityFrameworkVersion.IsValidVersion(targetSchemaVersion), "invalid target schema version");

            var inputXml = new XmlDocument { PreserveWhitespace = true };
            using (var reader = xdoc.CreateReader())
            {
                inputXml.Load(reader);
            }

            var outputXml = converter.Convert(inputXml, targetSchemaVersion);
            if (outputXml != null)
            {
                // Dev10 Bug 550594: There is a bug in XmlEditor that prevents from deleting the root node
                // unless the root node has previous sibling (like a comment or Xml declaration).
                if (xdoc.Root.PreviousNode == null)
                {
                    xdoc.Root.AddBeforeSelf(new XComment(""));
                }

                // update xml document with new root element
                xdoc.Root.Remove();
                using (var reader = new XmlNodeReader(outputXml))
                {
                    var newDoc = XDocument.Load(reader);
                    xdoc.Add(newDoc.Root);
                }

                // Do not reload artifact here
                // Until the transaction is commited, the XLinq representation of the parsed xml tree hasn't been generated yet.
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:34,代码来源:RetargetXmlNamespaceCommand.cs


示例4: ReadConfig

 private static CassandraSharpConfig ReadConfig(XmlDocument xmlDoc)
 {
     XmlSerializer xmlSer = new XmlSerializer(typeof(CassandraSharpConfig));
     //MiniXmlSerializer xmlSer = new MiniXmlSerializer(typeof(CassandraSharpConfig));
     using (XmlReader xmlReader = new XmlNodeReader(xmlDoc))
         return (CassandraSharpConfig)xmlSer.Deserialize(xmlReader);
 }
开发者ID:kpaskal,项目名称:cassandra-sharp,代码行数:7,代码来源:SectionHandler.cs


示例5: TransformNode

        public static void TransformNode(XmlNode element, XmlReader xslTemplate)
        {
            XmlReader reader = new XmlNodeReader(element);

              XmlReader transformResultReader = TransformXml(reader, xslTemplate, null);
              element.CreateNavigator().ReplaceSelf(transformResultReader);
        }
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:7,代码来源:XslUtils.cs


示例6: ToXDocument

 /// <summary>
 /// Converts XmlDocument to XDocument using load options.
 /// </summary>
 /// <param name="document">
 /// The input document to be converted.
 /// </param>
 /// <param name="options">
 /// The options for the conversion.
 /// </param>
 /// <returns>
 /// Resulting XDocument.
 /// </returns>
 public static XDocument ToXDocument(this XmlDocument document, LoadOptions options)
 {
     using (XmlNodeReader reader = new XmlNodeReader(document))
     {
         return XDocument.Load(reader, options);
     }
 }
开发者ID:chien-andalou,项目名称:QuickRoutes,代码行数:19,代码来源:XmlDocumentExtensions.cs


示例7: ToBackpackObject

        // converts the given xml document to an object of the given type.
        public static IBackpackObject ToBackpackObject(this XmlDocument xmlDocument, System.Type objType)
        {
            XmlNodeReader xmlNodeReader = new XmlNodeReader(xmlDocument.DocumentElement);
            XmlSerializer xmlSerializer = new XmlSerializer(objType);

            return (IBackpackObject)xmlSerializer.Deserialize(xmlNodeReader);
        }
开发者ID:jonezy,项目名称:backpackapi,代码行数:8,代码来源:ExtensionMethods.cs


示例8: Read

        public static void Read(XmlDocument xml)
        {
            List<DecModel> list = new List<DecModel>();
            XNamespace ns = "HTTP://CLIS.HB_DEC";

            using (var nodeReader = new XmlNodeReader(xml))
            {
                nodeReader.MoveToContent();
                XDocument xdoc= XDocument.Load(nodeReader);

                var seqNo = xdoc.Descendants(ns + "SEQ_NO").First().Value;
                var entryId = xdoc.Descendants(ns + "ENTRY_ID").First().Value;
                var ieFlag = xdoc.Descendants(ns + "I_E_FLAG").First().Value;

                foreach (var element in xdoc.Descendants(ns + "HB_DEC_LIST"))
                {
                    Console.WriteLine(element.Element(ns + "COP_G_NO").Value, element.Element(ns + "QTY").Value);
                    DecModel item = new DecModel();
                    item.EntryId = entryId;
                    item.SeqNo = seqNo;
                    item.IEFlag = ieFlag;
                    item.GNo = element.Element(ns + "COP_G_NO").Value;
                    item.Qty = Convert.ToDecimal(element.Element(ns + "QTY").Value);
                    list.Add(item);
                }

                if (list.Count > 0)
                {
                    SqlHelper.Insert(list);
                }
               

            }
        }
开发者ID:neozhu,项目名称:Kaifa.B2B.Solution,代码行数:34,代码来源:HBDec.cs


示例9: fillCountry

        public static void fillCountry(ComboBox objCmbCountry,String CountryCode)
        {
            //DataTable objDT = new DataTable("Country");
            //DataRow objRow;
            //DataColumn objcol =new DataColumn("ContryName",typeof(System.String));
            //objDT.Columns.Add(objcol);

            //objcol =new DataColumn("ContryId",typeof(System.String));
            //objDT.Columns.Add(objcol);

            XmlNodeReader objXmlReader;
            DataSet ds = new DataSet();
            XmlDocument  objOutXml = new XmlDocument();
            String strInput = "<MS_LISTCOUNTRY_OUTPUT><COUNTRY  COUNTRY_CODE='0' COUNTRY_NAME='Select one'/><COUNTRY  COUNTRY_CODE='BD' COUNTRY_NAME='Bangladesh'/><COUNTRY  COUNTRY_CODE='IN' COUNTRY_NAME='India' /><COUNTRY  COUNTRY_CODE='NP' COUNTRY_NAME='Nepal' /> <COUNTRY  COUNTRY_CODE='LK' COUNTRY_NAME='Srilanka' /><COUNTRY  COUNTRY_CODE='BT' COUNTRY_NAME='Bhutan' /><COUNTRY  COUNTRY_CODE='ML' COUNTRY_NAME='Maldives' /><COUNTRY  COUNTRY_CODE='TB' COUNTRY_NAME='TBA' /> <Errors Status='False'><Error Code='' Description='' /></Errors></MS_LISTCOUNTRY_OUTPUT>";
            objOutXml.LoadXml(strInput);

            objXmlReader = new XmlNodeReader(objOutXml);
            ds.ReadXml(objXmlReader);
            objCmbCountry.DataSource = ds.Tables["COUNTRY"];
            objCmbCountry.DisplayMember = "COUNTRY_NAME";
            objCmbCountry.ValueMember = "COUNTRY_CODE";
            objCmbCountry.SelectedIndex = 0;
            if (CountryCode !="")
            {
                objCmbCountry.SelectedIndex = objCmbCountry.FindString("India");
            }
        }
开发者ID:ngoswami1978,项目名称:Query-Scheduler-CSharp,代码行数:27,代码来源:QueryClass.cs


示例10: Deserialise

 private static Projects Deserialise(XmlDocument xmlDoc)
 {
     var nodeReader = new XmlNodeReader(xmlDoc);
     nodeReader.ReadToDescendant("Projects");
     var result = Serialiser.Deserialize(nodeReader);
     return (Projects)result;
 }
开发者ID:azdlowry,项目名称:GoDashboard,代码行数:7,代码来源:PipelineDeserialiser.cs


示例11: BindData

		public void BindData()
        {
            #region 绑定轮换图片列表
            DataGrid1.AllowCustomPaging = false;
			DataGrid1.DataKeyField = "rotatepicid";
            DataGrid1.TableHeaderName = "聚合轮换图片列表";

			XmlDocumentExtender xmldocument = new XmlDocumentExtender();
			xmldocument.Load(configPath);
			XmlNode node = xmldocument.SelectSingleNode(targetNode);
            if (node == null || node.ChildNodes.Count == 0)
            {
                DataGrid1.Visible = SaveRotatepic.Visible = false;
                return;
            }
			XmlNodeReader rdr = new XmlNodeReader(node);
			dsSrc.ReadXml(rdr);
            dsSrc.Tables[0].Columns.Add("rowid");
            int i = 0;
            foreach (DataRow dr in dsSrc.Tables[0].Rows)
            {
                dr["rowid"] = i.ToString();
                i++;
            }
			DataGrid1.DataSource = dsSrc.Tables[0];
			DataGrid1.DataBind();
            #endregion
        }
开发者ID:ChalmerLin,项目名称:dnt_v3.6.711,代码行数:28,代码来源:aggregation_rotatepic.aspx.cs


示例12: Invoke

        /// <summary>
        /// Executes the command logics.
        /// </summary>
        public override void Invoke()
        {
            //print request xml
            var doc = new XmlDocument();
            var stringWriter = new StringWriter();

            //get your document
            try
            {
                doc.LoadXml(this.document.Text);
            }
            catch (Exception)
            {
                return;
            }

            //create reader and writer
            var xmlReader = new XmlNodeReader(doc);

            //set formatting options
            var xmlWriter = new XmlTextWriter(stringWriter)
                                {
                                    Formatting = Formatting.Indented,
                                    Indentation = 3,
                                    IndentChar = ' '
                                };

            //write the document formatted
            xmlWriter.WriteNode(xmlReader, true);

            this.document.Text = stringWriter.ToString();
        }
开发者ID:Waltervondehans,项目名称:NBi,代码行数:35,代码来源:AutoIndentCommand.cs


示例13: Create

		public object Create(object parent, object configContext, XmlNode section)
		{
			ILog _log = null;
			try
			{
				_log = LogManager.GetLogger(typeof(XmlConfigurator));
			}
			catch{}

			object settings = null;
			if (section == null) 
				return settings;

			XmlSerializer xmlSerializer = new XmlSerializer(typeof(FluorineSettings));
			XmlNodeReader reader = new XmlNodeReader(section);
			try
			{
				settings = xmlSerializer.Deserialize(reader);
			}
			catch(Exception ex)
			{
				if( _log != null && _log.IsErrorEnabled )
					_log.Error(ex.Message, ex);
			}
			finally
			{
				xmlSerializer = null;
			}
			return settings;
		}
开发者ID:ByteSempai,项目名称:Ubiquitous,代码行数:30,代码来源:XmlConfigurator.cs


示例14: XmlPackage

 /// <summary>
 /// 从序列化的Xml文档中还原对象
 /// </summary>
 public XmlPackage(XmlDocument xmlDoc)
 {
     XmlNodeReader reader = new XmlNodeReader(xmlDoc.DocumentElement);
     XmlSerializer ser = new XmlSerializer(typeof(XmlPackage));
     XmlPackage pkg = (XmlPackage)ser.Deserialize(reader);
     this.SetPackageDictionary(pkg.GetPackageDictionary());
 }
开发者ID:vbyte,项目名称:fmq,代码行数:10,代码来源:XmlPackage.cs


示例15: Create

        public object Create( object parent, object configContext, XmlNode section )
        {
            XPathNavigator navigator = section.CreateNavigator();
            string typeName = ( string )navigator.Evaluate( "string(@type)" );

            if( string.IsNullOrEmpty( typeName ) )
                throw new ConfigurationErrorsException( string.Format( MISSING_TYPE_MSG, section.Name ), section );

            Type type = Type.GetType( typeName );
            if( type == null )
                throw new ConfigurationErrorsException( string.Format( NULL_TYPE_MSG, typeName, section.Name ), section );

            XmlSerializer serializer = new XmlSerializer( type );
            XmlNodeReader reader = new XmlNodeReader( section );

            try
            {
                return serializer.Deserialize( reader );
            }
            catch( Exception ex )
            {
                throw new ConfigurationErrorsException(
                    string.Format( FAILED_DESERIALIZE_MSG, typeName, section.Name, FormattedInnerExceptions( ex ) ),
                    ex, section );
            }
        }
开发者ID:ghostmonk,项目名称:GhostmonkWeb,代码行数:26,代码来源:XmlSerializerConfigSectionHandler.cs


示例16: getUserFromResponse

 public User getUserFromResponse(XmlNodeReader xmlNodeReader)
 {
     // deserialize the user message
     XmlSerializer deserializer = new XmlSerializer(typeof(User));
     User user = (User)deserializer.Deserialize(xmlNodeReader);
     return user;
 }
开发者ID:chasedm,项目名称:openscim,代码行数:7,代码来源:Client.cs


示例17: Get_AniDB_File

		public static AniDB_FileRequest Get_AniDB_File(string hash, long filesize)
		{
			// turn this off for now until the bugs are sorted out
			return null;

			if (!ServerSettings.WebCache_AniDB_File_Get) return null;

			try
			{

				string uri = string.Format("http://{0}/GetAniDB_File.aspx?hash={1}&fsize={2}",
					ServerSettings.WebCache_Address, hash, filesize);
				string xml = GetData(uri);

				if (xml.Trim().Length == 0) return null;

				XmlSerializer serializer = new XmlSerializer(typeof(AniDB_FileRequest));
				XmlDocument docSearchResult = new XmlDocument();
				docSearchResult.LoadXml(xml);

				XmlNodeReader reader = new XmlNodeReader(docSearchResult.DocumentElement);
				object obj = serializer.Deserialize(reader);
				return (AniDB_FileRequest)obj;

			}
			catch (Exception ex)
			{
				logger.ErrorException("Error in XMLService.Get_FileHash:: {0}", ex);
				return null;
			}
		}
开发者ID:dizzydezz,项目名称:jmm,代码行数:31,代码来源:XMLService.cs


示例18: isSuper

 //�ΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡΡ�
 public bool isSuper(FileInfo obFile, FileInfo obExtends)
 {
     string infoPath = m_obFinder.getClassPath(obExtends.Name.Replace(".as", ""));
     if (File.Exists(infoPath))
     {
         XmlDocument xml = new XmlDocument();
         xml.Load(infoPath);
         XmlNodeReader reader = new XmlNodeReader(xml);
         while (reader.Read())
         {
             if (reader.NodeType == XmlNodeType.Element)
             {
                 if (reader.Name == "item")
                 {
                     string className = reader.GetAttribute("name");
                     string superSign = reader.GetAttribute("super");
                     if (className == obFile.Name.Replace(".as", ""))
                     {
                         if (superSign != null)
                         {
                             reader.Close();
                             //ErrorBox.Show(obExtends.Name + " extends " + obFile.Name,"ClassRelationsFinderError");
                             return true;
                         }
                     }
                 }
             }
         }
     }
     return false;
 }
开发者ID:r1ng0to3tour,项目名称:swsplayer,代码行数:32,代码来源:ClassRelationsFinder.cs


示例19: ToXDocument

 public static XDocument ToXDocument(this XmlDocument xmlDocument)
 {
     using (var nodeReader = new XmlNodeReader(xmlDocument)) {
         nodeReader.MoveToContent();
         return XDocument.Load(nodeReader);
     }
 }
开发者ID:fcmendoza,项目名称:Tracking,代码行数:7,代码来源:TransactionRepository.cs


示例20: Create

		public Object Create(
			Object parent,
			Object configContext,
			System.Xml.XmlNode section)
		{
			Object settings = null;
			if (section == null)
				return settings;

			XPathNavigator nav = section.CreateNavigator();
			String typeName = (String) nav.Evaluate("string(@type)");
			Type sectionType = Type.GetType(typeName);

			XmlSerializer s = new XmlSerializer(sectionType);
			XmlNodeReader r = new XmlNodeReader(section);

			try
			{
				settings = s.Deserialize(r);
			}
			catch (Exception e)
			{

				if ( e.InnerException != null )
					Debug.WriteLine( String.Format("exception:\n{0}\n{1}", e.Message, e.InnerException.Message ) );
				else
					Debug.WriteLine( String.Format("exception:\n{0}", e.Message ) );
			}
			finally
			{
				s = null;
			}

			return settings;
		}
开发者ID:BrianGoff,项目名称:BITS,代码行数:35,代码来源:XmlConfigurator.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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