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

C# Xml.XmlNode类代码示例

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

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



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

示例1: SetAttribute

 public static void SetAttribute( XmlNode node, string attributeName, string attributeValue )
 {
     if ( node.Attributes[ attributeName ] != null )
         node.Attributes[ attributeName ].Value = attributeValue ;
     else
         node.Attributes.Append( CreateAttribute( node.OwnerDocument, attributeName, attributeValue ) ) ;
 }
开发者ID:ErekTan,项目名称:HLedo,代码行数:7,代码来源:XmlUtil.cs


示例2: XmlAttributeCollection

		internal XmlAttributeCollection (XmlNode parent) : base (parent)
		{
			ownerElement = parent as XmlElement;
			ownerDocument = parent.OwnerDocument;
			if(ownerElement == null)
				throw new XmlException ("invalid construction for XmlAttributeCollection.");
		}
开发者ID:nobled,项目名称:mono,代码行数:7,代码来源:XmlAttributeCollection.cs


示例3: Create

        public virtual object Create(object parent, object configContext, XmlNode section)
        {
            if (section == null)
                throw new ArgumentNullException("section");

            IList list = CreateList(parent);

            string itemName = ElementName;

            foreach (XmlNode childNode in section.ChildNodes)
            {
                if (childNode.NodeType == XmlNodeType.Comment ||
                    childNode.NodeType == XmlNodeType.Whitespace)
                {
                    continue;
                }

                if (childNode.NodeType != XmlNodeType.Element)
                {
                    throw new ConfigurationErrorsException(string.Format("Unexpected type of node ({0}) in configuration.", 
                        childNode.NodeType.ToString()), childNode);
                }

                if (childNode.Name != itemName)
                {
                    throw new ConfigurationErrorsException(string.Format("Element <{0}> is not valid here in configuration. Use <{1}> elements only.", 
                        childNode.Name, itemName), childNode);
                }

                list.Add(GetItem((XmlElement) childNode));
            }
            
            return list;
        }
开发者ID:liuxing7954,项目名称:cangku_1,代码行数:34,代码来源:ListSectionHandler.cs


示例4: GetDisplayName

	public static string GetDisplayName (XmlNode type)
	{
		if (type.Attributes ["DisplayName"] != null) {
			return type.Attributes ["DisplayName"].Value;
		}
		return type.Attributes ["Name"].Value;
	}
开发者ID:RAOF,项目名称:mono,代码行数:7,代码来源:ecma-provider.cs


示例5: ParameterValues

        List<ParameterValue> _Items; // list of ParameterValue

        #endregion Fields

        #region Constructors

        internal ParameterValues(ReportDefn r, ReportLink p, XmlNode xNode)
            : base(r, p)
        {
            ParameterValue pv;
            _Items = new List<ParameterValue>();
            // Loop thru all the child nodes
            foreach(XmlNode xNodeLoop in xNode.ChildNodes)
            {
                if (xNodeLoop.NodeType != XmlNodeType.Element)
                    continue;
                switch (xNodeLoop.Name)
                {
                    case "ParameterValue":
                        pv = new ParameterValue(r, this, xNodeLoop);
                        break;
                    default:
                        pv=null;		// don't know what this is
                        // don't know this element - log it
                        OwnerReport.rl.LogError(4, "Unknown ParameterValues element '" + xNodeLoop.Name + "' ignored.");
                        break;
                }
                if (pv != null)
                    _Items.Add(pv);
            }

            if (_Items.Count == 0)
                OwnerReport.rl.LogError(8, "For ParameterValues at least one ParameterValue is required.");
            else
                _Items.TrimExcess();
        }
开发者ID:bittercoder,项目名称:odd-reports,代码行数:36,代码来源:ParameterValues.cs


示例6: APIVariable

		public APIVariable(APIPage InParent, XmlNode InNode)
			: base(InParent, InNode.SelectSingleNode("name").InnerText)
		{
			Node = InNode;
			Protection = ParseProtection(Node);
			AddRefLink(Node.Attributes["id"].InnerText, this);
		}
开发者ID:xiangyuan,项目名称:Unreal4,代码行数:7,代码来源:APIVariable.cs


示例7: AddNodeArgumentsRecursive

        public void AddNodeArgumentsRecursive(XmlNode node, string subName, Dictionary<string, string> inputDic, string inputType, bool recursive)
        {
            if (node == null)
            {
                return;
            }

            foreach (XmlAttribute attr in node.Attributes)
            {
                string key = attr.LocalName;
                if (subName != "")
                {
                    key = subName + "." + attr.LocalName;
                }
                AddToArgDic(inputDic, key, attr.Value, inputType);
            }
            foreach (XmlNode childNode in node.ChildNodes)
            {
                string childName = childNode.LocalName;
                if (childNode.NodeType == XmlNodeType.Text)
                {
                    AddToArgDic(inputDic, subName, childNode.Value, inputType);
                }
                if (childNode.NodeType == XmlNodeType.Element && recursive)
                {
                    if (subName != "")
                    {
                        childName = subName + "." + childName;
                    }
                    AddNodeArgumentsRecursive(childNode, childName, inputDic, inputType, true);
                }
            }
        }
开发者ID:MarMar,项目名称:SeeFlaw,代码行数:33,代码来源:Runner.cs


示例8: LoadDataFromInventory

		/// <summary>
		/// Get protected and user-stored dictionary configurations to load into the dialog.
		/// Tests will override this to load the manager in their own fashion.
		/// </summary>
		private void LoadDataFromInventory(XmlNode current)
		{
			// Tuples are <uniqueCode, dispName, IsProtected>
			var configList = new List<Tuple<string, string, bool>>();

			// put them in configList and feed them into the Manager's dictionary.
			foreach (var xnView in m_originalViewConfigNodes)
			{
				var sLabel = XmlUtils.GetManditoryAttributeValue(xnView, "label");
				var sLayout = XmlUtils.GetManditoryAttributeValue(xnView, "layout");
				var fProtected = !sLayout.Contains(Inventory.kcMarkLayoutCopy);
				configList.Add(new Tuple<string, string, bool>(sLayout, sLabel, fProtected));
			}

			LoadInternalDictionary(configList);

			var sLayoutCurrent = XmlUtils.GetManditoryAttributeValue(current, "layout");
			m_originalView = sLayoutCurrent;
			m_currentView = m_originalView;

			if (m_configList.Count == 0)
				return;

			// Now set up the actual dialog's contents
			RefreshView();
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:30,代码来源:DictionaryConfigManager.cs


示例9: DownloadLrc

        public string DownloadLrc(string singer, string title)
        {
            this.currentSong = null;
            XmlDocument xml = SearchLrc(singer, title);
            string retStr = "û���ҵ��ø��";
            if (xml == null)
                return retStr;

            XmlNodeList list = xml.SelectNodes("/result/lrc");
            if (list.Count > 0) {
                this.OnSelectSong(list);
                if (this.currentSong == null)
                    this.currentSong = list[0];
            } else if (list.Count == 1) {
                this.currentSong = list[0];
            } else {
                return retStr;
            }
            if (this.currentSong == null)
                return retStr;

            XmlNode node = this.currentSong;
            int lrcId = -1;
            if (node != null && node.Attributes != null && node.Attributes["id"] != null) {
                string sLrcId = node.Attributes["id"].Value;
                if (int.TryParse(sLrcId, out lrcId)) {
                    string xSinger = node.Attributes["artist"].Value;
                    string xTitle = node.Attributes["title"].Value;
                    retStr = RequestALink(string.Format(DownloadPath, lrcId,
                        EncodeHelper.CreateQianQianCode(xSinger, xTitle, lrcId)));
                }
            }
            return retStr;
        }
开发者ID:jasine,项目名称:SaveDouban,代码行数:34,代码来源:QianQianLrcer.cs


示例10: ClearQueue

 public ClearQueue(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode actionTypeNode = xmlNode.SelectSingleNode("actionType");
     
     if (actionTypeNode != null)
     {
         if (actionTypeNode.Attributes["href"] != null || actionTypeNode.Attributes["id"] != null) 
         {
             if (actionTypeNode.Attributes["id"] != null) 
             {
                 actionTypeIDRef_ = actionTypeNode.Attributes["id"].Value;
                 XsdTypeToken ob = new XsdTypeToken(actionTypeNode);
                 IDManager.SetID(actionTypeIDRef_, ob);
             }
             else if (actionTypeNode.Attributes["href"] != null)
             {
                 actionTypeIDRef_ = actionTypeNode.Attributes["href"].Value;
             }
             else
             {
                 actionType_ = new XsdTypeToken(actionTypeNode);
             }
         }
         else
         {
             actionType_ = new XsdTypeToken(actionTypeNode);
         }
     }
     
 
 }
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:32,代码来源:ClearQueue.cs


示例11: from

        public void from(XmlNode node, XmlNamespaceManager xnm, string prefix, string subfix)
        {
            Type type = this.GetType();
            FieldInfo[] fields = type.GetFields(BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.Public);

            foreach (FieldInfo field in fields)
            {
                string query = prefix +ObjectUtil.GetSimpleName(field) + subfix;
                try
                {
                    string value = null;
                    XmlNode tempNode;
                    if (xnm != null)
                    {
                        tempNode = node.SelectSingleNode(query, xnm);
                    }
                    else
                    {
                        tempNode = node.SelectSingleNode(query);
                    }
                    if (tempNode == null) {
                        field.SetValue(this,XML_NULL);
                        continue;
                    }
                    value = tempNode.InnerText;
                    field.SetValue(this, value);
                }
                catch (Exception ex) { }
            }
        }
开发者ID:uhealin,项目名称:toyz-toyz4net,代码行数:30,代码来源:BaseAdapter.cs


示例12: XmlElement

	// Constructor.
	internal XmlElement(XmlNode parent, NameCache.NameInfo name)
			: base(parent)
			{
				this.name = name;
				this.attributes = null;
				this.isEmpty = true;
			}
开发者ID:jjenki11,项目名称:blaze-chem-rendering,代码行数:8,代码来源:XmlElement.cs


示例13: DataSetReference

		Field _lField;			// resolved label name
		internal DataSetReference(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			_DataSetName=null;
			_ValueField=null;
			_LabelField=null;

			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				switch (xNodeLoop.Name)
				{
					case "DataSetName":
						_DataSetName = xNodeLoop.InnerText;
						break;
					case "ValueField":
						_ValueField = xNodeLoop.InnerText;
						break;
					case "LabelField":
						_LabelField = xNodeLoop.InnerText;
						break;
					default:
						// don't know this element - log it
						OwnerReport.rl.LogError(4, "Unknown DataSetReference element '" + xNodeLoop.Name + "' ignored.");
						break;
				}
			}
			if (_DataSetName == null)
				OwnerReport.rl.LogError(8, "DataSetReference DataSetName is required but not specified.");
			if (_ValueField == null)
				OwnerReport.rl.LogError(8, "DataSetReference ValueField is required but not specified for" + _DataSetName==null? "<unknown name>": _DataSetName);
		}
开发者ID:romeroyonatan,项目名称:opendental,代码行数:34,代码来源:DataSetReference.cs


示例14: TableGroups

        List<TableGroup> _Items;			// list of TableGroup entries

		internal TableGroups(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			TableGroup tg;
            _Items = new List<TableGroup>();
			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				switch (xNodeLoop.Name)
				{
					case "TableGroup":
						tg = new TableGroup(r, this, xNodeLoop);
						break;
					default:	
						tg=null;		// don't know what this is
						// don't know this element - log it
						OwnerReport.rl.LogError(4, "Unknown TableGroups element '" + xNodeLoop.Name + "' ignored.");
						break;
				}
				if (tg != null)
					_Items.Add(tg);
			}
			if (_Items.Count == 0)
				OwnerReport.rl.LogError(8, "For TableGroups at least one TableGroup is required.");
			else
                _Items.TrimExcess();
		}
开发者ID:mnisl,项目名称:OD,代码行数:30,代码来源:TableGroups.cs


示例15: Excel_cds

 public Excel_cds(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode excel_swapLegNode = xmlNode.SelectSingleNode("excel_swapLeg");
     
     if (excel_swapLegNode != null)
     {
         if (excel_swapLegNode.Attributes["href"] != null || excel_swapLegNode.Attributes["id"] != null) 
         {
             if (excel_swapLegNode.Attributes["id"] != null) 
             {
                 excel_swapLegIDRef_ = excel_swapLegNode.Attributes["id"].Value;
                 Excel_swapLeg ob = new Excel_swapLeg(excel_swapLegNode);
                 IDManager.SetID(excel_swapLegIDRef_, ob);
             }
             else if (excel_swapLegNode.Attributes["href"] != null)
             {
                 excel_swapLegIDRef_ = excel_swapLegNode.Attributes["href"].Value;
             }
             else
             {
                 excel_swapLeg_ = new Excel_swapLeg(excel_swapLegNode);
             }
         }
         else
         {
             excel_swapLeg_ = new Excel_swapLeg(excel_swapLegNode);
         }
     }
     
 
     XmlNode excel_creditEventSwapLegNode = xmlNode.SelectSingleNode("excel_creditEventSwapLeg");
     
     if (excel_creditEventSwapLegNode != null)
     {
         if (excel_creditEventSwapLegNode.Attributes["href"] != null || excel_creditEventSwapLegNode.Attributes["id"] != null) 
         {
             if (excel_creditEventSwapLegNode.Attributes["id"] != null) 
             {
                 excel_creditEventSwapLegIDRef_ = excel_creditEventSwapLegNode.Attributes["id"].Value;
                 Excel_creditEventSwapLeg ob = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
                 IDManager.SetID(excel_creditEventSwapLegIDRef_, ob);
             }
             else if (excel_creditEventSwapLegNode.Attributes["href"] != null)
             {
                 excel_creditEventSwapLegIDRef_ = excel_creditEventSwapLegNode.Attributes["href"].Value;
             }
             else
             {
                 excel_creditEventSwapLeg_ = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
             }
         }
         else
         {
             excel_creditEventSwapLeg_ = new Excel_creditEventSwapLeg(excel_creditEventSwapLegNode);
         }
     }
     
 
 }
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:60,代码来源:Excel_cds.cs


示例16: TableColumn

		bool _FixedHeader=false;	// Header of this column should be display even when scrolled
	
		internal TableColumn(ReportDefn r, ReportLink p, XmlNode xNode) : base(r, p)
		{
			_Width=null;
			_Visibility=null;

			// Loop thru all the child nodes
			foreach(XmlNode xNodeLoop in xNode.ChildNodes)
			{
				if (xNodeLoop.NodeType != XmlNodeType.Element)
					continue;
				switch (xNodeLoop.Name)
				{
					case "Width":
						_Width = new RSize(r, xNodeLoop);
						break;
					case "Visibility":
						_Visibility = new Visibility(r, this, xNodeLoop);
						break;
					case "FixedHeader":
						_FixedHeader = XmlUtil.Boolean(xNodeLoop.InnerText, OwnerReport.rl);
						break;
					default:
						// don't know this element - log it
						OwnerReport.rl.LogError(4, "Unknown TableColumn element '" + xNodeLoop.Name + "' ignored.");
						break;
				}
			}
			if (_Width == null)
				OwnerReport.rl.LogError(8, "TableColumn requires the Width element.");
		}
开发者ID:mnisl,项目名称:OD,代码行数:32,代码来源:TableColumn.cs


示例17: RefVariable_returnValue

 public RefVariable_returnValue(XmlNode xmlNode)
 : base(xmlNode)
 {
     XmlNode variableInfoNode = xmlNode.SelectSingleNode("variableInfo");
     
     if (variableInfoNode != null)
     {
         if (variableInfoNode.Attributes["href"] != null || variableInfoNode.Attributes["id"] != null) 
         {
             if (variableInfoNode.Attributes["id"] != null) 
             {
                 variableInfoIDRef_ = variableInfoNode.Attributes["id"].Value;
                 VariableInfo ob = new VariableInfo(variableInfoNode);
                 IDManager.SetID(variableInfoIDRef_, ob);
             }
             else if (variableInfoNode.Attributes["href"] != null)
             {
                 variableInfoIDRef_ = variableInfoNode.Attributes["href"].Value;
             }
             else
             {
                 variableInfo_ = new VariableInfo(variableInfoNode);
             }
         }
         else
         {
             variableInfo_ = new VariableInfo(variableInfoNode);
         }
     }
     
 
 }
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:32,代码来源:RefVariable_returnValue.cs


示例18: Read

        /// <summary>
        /// Reads a URI.
        /// </summary>
        /// <param name="node">The node containing the URI.</param>
        /// <param name="table">The serialiser table.</param>
        /// <returns>A new instance of a <see cref="Uri"/> if the node is valid; null otherwise.</returns>
        public override object Read(XmlNode node, NetReflectorTypeTable table)
        {
            if (node == null)
            {
                // NetReflector should do this check, but doesn't
                if (this.Attribute.Required)
                {
                    throw new NetReflectorItemRequiredException(Attribute.Name + " is required");
                }
                else
                {
                    return null;
                }
            }

            Uri ret;
            if (node is XmlAttribute)
            {
                ret = new Uri(node.Value);
            }
            else
            {
                ret = new Uri(node.InnerText);
            }

            return ret;
        }
开发者ID:kascomp,项目名称:CruiseControl.NET,代码行数:33,代码来源:UriSerializer.cs


示例19: Variable

 public Variable(XmlNode xmlNode)
 {
     XmlNodeList symbolNameNodeList = xmlNode.SelectNodes("symbolName");
     if (symbolNameNodeList.Count > 1 )
     {
             throw new Exception();
     }
     
     foreach (XmlNode item in symbolNameNodeList)
     {
         if (item.Attributes["href"] != null || item.Attributes["id"] == null) 
         {
             if (item.Attributes["id"] != null) 
             {
                 symbolNameIDRef = item.Attributes["id"].Name;
                 XsdTypeToken ob = XsdTypeToken();
                 IDManager.SetID(symbolNameIDRef, ob);
             }
             else if (item.Attributes.ToString() == "href")
             {
                 symbolNameIDRef = item.Attributes["href"].Name;
             }
             else
             {
                 symbolName = new XsdTypeToken(item);
             }
         }
     }
     
 
 }
开发者ID:minikie,项目名称:OTCDerivativesCalculatorModule,代码行数:31,代码来源:Variable.cs


示例20: InflAffixTemplateEventArgs

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="context"/>
		/// <param name="location"/>
		public InflAffixTemplateEventArgs(Control context, XmlNode node, Point location, int tag)
		{
			m_location = location;
			m_node = node;
			m_contextControl = context;
			m_tag = tag;
		}
开发者ID:bbriggs,项目名称:FieldWorks,代码行数:12,代码来源:InflAffixTemplateEventArgs.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# Xml.XmlNodeChangedEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Xml.XmlNamespaceManager类代码示例发布时间: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