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


C# Xml.XmlNode类代码示例

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


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


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