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


C# XmlNode.CreateNavigator方法代码示例

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


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

示例1: Create

        /// <summary>
        /// Creates the object representing the configuration section. The section will
        /// be serialized into the type specified by the type attribute in the xml.
        /// 
        /// This method is called by the framework, for example when ConfiguratinManager.GetSection() 
        /// is called. It should not be called directly by client code. 
        /// </summary>
        /// <param name="parent">Parent object</param>
        /// <param name="configContext">Configuration context object</param>
        /// <param name="section">Section XML node</param>
        /// <returns></returns>
        public object Create(object parent, object configContext, XmlNode section)
        {
            XPathNavigator nav = section.CreateNavigator();
            string typename = (string)nav.Evaluate("string(@type)");
            Type type = Type.GetType(typename);

            if (type == null)
            {
                throw new ConfigurationErrorsException(
                    string.Format("Type '{0}' specified with the XmlSerializerSectionHandler could not be resolved.", typename)
                    );
            }

            try
            {
                using (XmlNodeReader xmlNodeReader = new XmlNodeReader(section))
                {
                    XmlSerializer xmlSerializer = new XmlSerializer(type);
                    return xmlSerializer.Deserialize(xmlNodeReader);
                }
            }
            catch (InvalidOperationException ex)
            {
                // Unwrap any exception
                if (ex.InnerException != null)
                    throw ex.InnerException;
                throw;
            }
        }
开发者ID:fortinmike,项目名称:buildscreen,代码行数:40,代码来源:XmlSerializerSectionHandler.cs

示例2: 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

示例3: 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

示例4: Create

 public object Create(object parent, object configContext, XmlNode section)
 {
     XPathNavigator nav = section.CreateNavigator();
     var typename = (string)nav.Evaluate("string(@type)");
     Type t = Type.GetType(typename);
     var ser = new XmlSerializer(t);
     return ser.Deserialize(new XmlNodeReader(section));
 }
开发者ID:ChrisPelatari,项目名称:SubText,代码行数:8,代码来源:XmlSerializerSectionHandler.cs

示例5: Create

 /// <summary>
 /// Creates a configuration section handler.
 /// </summary>
 /// <returns>
 /// The created section handler object.
 /// </returns>
 /// <param name="parent">Parent object.</param><param name="configContext">Configuration context object.</param><param name="section">Section XML node.</param><filterpriority>2</filterpriority>
 public object Create(object parent, object configContext, XmlNode section)
 {
     var navigator = section.CreateNavigator();
     var typeOfObject = (string)navigator.Evaluate("string(@type)");
     var type = Type.GetType(typeOfObject);
     var xmlSerializer = new XmlSerializer(type);
     var nodeReader = new XmlNodeReader(section);
     return xmlSerializer.Deserialize(nodeReader);
 }
开发者ID:eagleboost,项目名称:EfficientlyLazy.Crypto,代码行数:16,代码来源:SecureSectionHandler.cs

示例6: Create

 public object Create(object parent, object configContext, XmlNode section)
 {
     if (section == null)
     {
         return null;
     }
     _config = section.CreateNavigator();
     return this;
 }
开发者ID:zibler,项目名称:zibler,代码行数:9,代码来源:Settings.cs

示例7: XmlSerializer

        //������ض�����ǰ���ýڵķ���
        object IConfigurationSectionHandler.Create(object parent, object configContext, XmlNode section)
        {
            //XPathNavigator��ʹ���α�ģ�ʹ��������ݴ洢����ȡ���ݡ�
            XPathNavigator navigator = section.CreateNavigator();
            string text = (string)navigator.Evaluate("string(@type)");
            Type type = Type.GetType(text);
            XmlSerializer serializer = new XmlSerializer(type);

            return serializer.Deserialize(new XmlNodeReader(section));
        }
开发者ID:alloevil,项目名称:A-embedded-image-processing-platform--,代码行数:11,代码来源:XmlSerializerSectionHandler.cs

示例8: Create

        /// <summary>
        /// Create the configuration section.
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="configContext"></param>
        /// <param name="section"></param>
        /// <returns></returns>
        public object Create(object parent,
                            object configContext,
                            XmlNode section) {
            XPathNavigator nav = section.CreateNavigator();
            String typename = (String) nav.Evaluate("string(@type)");
            Type type = Type.GetType(typename);
            object theObject = this.GetConfigObject (type,
                            section.SelectSingleNode ("//" + SharpCvsLibConfig.SUB_SECTION));

            return theObject;
        }
开发者ID:Orvid,项目名称:NAntUniversalTasks,代码行数:18,代码来源:SharpCvsLibConfigHandler.cs

示例9: ApplyChanges

 public XmlDocument ApplyChanges(BaseDiffResultObjectList results, XmlNode originalDocument)
 {
     XmlDocument resultDocument = new XmlDocument();
     XPathNavigator navigator = originalDocument.CreateNavigator();
     foreach (var item in results.Items)
     {
         GetCommonNode(item, ref navigator);
     }
     resultDocument.LoadXml(navigator.OuterXml);
     return resultDocument;
 }
开发者ID:silvestrova,项目名称:Custom-XML-Diff,代码行数:11,代码来源:BaseDiffManager.cs

示例10: DoPostMerge

 private static void DoPostMerge(string outputPath, XmlNode mergedNode)
 {
     foreach (XmlNode partNode in mergedNode.SafeSelectNodes("layout/generate"))
     {
         partNode.Attributes.Remove(partNode.Attributes["combinedkey"]);
     }
     using (var writer = XmlWriter.Create(outputPath, CanonicalXmlSettings.CreateXmlWriterSettings()))
     {
         writer.WriteNode(mergedNode.CreateNavigator(), true);
     }
 }
开发者ID:StephenMcConnel,项目名称:flexbridge,代码行数:11,代码来源:CustomLayoutMergeService.cs

示例11: Create

        public object Create(object parent, object configContext, XmlNode section)
        {
            XPathNavigator nav = section.CreateNavigator();
            string typeName = (string)nav.Evaluate("string(@type)");
            Type t = Type.GetType(typeName);
            XmlSerializer ser = new XmlSerializer(t);
            XmlNodeReader xnr = new XmlNodeReader(section);
            object deSerialised = null;

            deSerialised = ser.Deserialize(xnr);

            return deSerialised;
        }
开发者ID:toepoke,项目名称:PosterBuilder,代码行数:13,代码来源:XmlHelpers.cs

示例12: DeserializeSection

		/// <summary>
		/// Returns an object deserialized from an Xml Configuration Section.
		/// </summary>
		/// <param name="section">The configuration section containing the settings.</param>
		/// <param name="settingsTarget">The existing settings object to copy the new settings to.</param>
		/// <returns></returns>
		static object DeserializeSection(XmlNode section)
		{
			XPathNavigator navigator = section.CreateNavigator(); 

			string typename = (string)navigator.Evaluate("string(@type)");

			Type type = Type.GetType(typename);
			if(type == null)
				throw new ConfigurationException("The type '" + typename + "' is not a valid type. Double check the type parameter.");
			XmlSerializer serializer = new XmlSerializer(type); 

			return serializer.Deserialize(new XmlNodeReader(section));
		}
开发者ID:Munter,项目名称:semihkirdinli.github.io,代码行数:19,代码来源:XmlSectionSettingsBase.cs

示例13: Create

 public object Create(object parent, object configContext, XmlNode section)
 {
     try
     {
         string typeName = (string)section.CreateNavigator().Evaluate("string(@type)");
         string configSouce = (string)section.CreateNavigator().Evaluate("string(@configSouce)");
         XmlSerializer serializer = new XmlSerializer(Type.GetType(typeName), new XmlRootAttribute(section.Name));
         if (!string.IsNullOrEmpty(configSouce))
         {
             using (XmlTextReader tr = new XmlTextReader(Config.BasePath + configSouce))
             {
                 return serializer.Deserialize(tr);
             }
         }
         return serializer.Deserialize(new XmlNodeReader(section));
     }
     catch (Exception e)
     {
         Log.Error("ReadServiceConfig.Create;" + e.Message);
     }
     return null;
 }
开发者ID:kcitwm,项目名称:dova,代码行数:22,代码来源:PlugConfig.cs

示例14: Create

 public object Create(object parent, object configContext, XmlNode section)
 {
     try
     {
         string typeName = (string) section.CreateNavigator().Evaluate("string(@type)");
         XmlSerializer serializer = new XmlSerializer(Type.GetType(typeName));
         return serializer.Deserialize(new XmlNodeReader(section));
     }
     catch(Exception e)
     {
         Log.Error("WriteServiceConfig.Create;" + e.Message);
     }
     return null;
 }
开发者ID:kcitwm,项目名称:dova,代码行数:14,代码来源:WriteServiceConfig.cs

示例15: ReisDeel

        public ReisDeel(XmlNode node)
        {
            var navigator = node.CreateNavigator();
            Vervoerder = navigator.Evaluate("string(Vervoerder)").ToString();
            VervoerType = navigator.Evaluate("string(VervoerType)").ToString();
            RitNummer = Convert.ToInt32(navigator.Evaluate("number(RitNummer)").ToString());
            GeplandeSoringId = navigator.Evaluate("string(GeplandeSoringId)").ToString();
            OngeplandeStoringId = navigator.Evaluate("string(OngeplandeStoringId)").ToString();

            ReisStops = new List<ReisStop>();
            foreach (XmlNode n in node.SelectNodes("ReisStop"))
            {
                ReisStops.Add(new ReisStop(n));
            }
        }
开发者ID:marius1,项目名称:wallboard,代码行数:15,代码来源:ReisMogelijkheid.cs


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