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


C# Xml.XmlNodeReader类代码示例

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


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


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