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


C# XmlElement类代码示例

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


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

示例1: Tbl_ChargeRecord

	public Tbl_ChargeRecord(XmlElement _element)
	{
		try
		{
			XmlNode node = (XmlElement)_element;

			foreach (XmlNode attribute in node.Attributes)
			{
				if (attribute.Name == "ProductID")
					itemID = attribute.Value;
				else if (attribute.Name == "Type")
				{
					if (attribute.Value == "SPHERE")
						chargeType = eCHARGETYPE.eCHARGETYPE_MIRACLE;
					else if (attribute.Value == "DAILY")
						chargeType = eCHARGETYPE.eCHARGETYPE_DAILY;
					else
						chargeType = eCHARGETYPE.eCHARGETYPE_NOTHING;
				}
				else if (attribute.Name == "DescriptionID")
					descriptionID = int.Parse(attribute.Value);
				else if (attribute.Name == "Icon")
					iconPath = attribute.Value;
				else if (attribute.Name == "UseTime")
					useTime = attribute.Value == "NONE" ? 0 : int.Parse(attribute.Value);
			}
		}
		catch (System.Exception e)
		{
			Debug.LogError(e);
		}
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:32,代码来源:Tbl_Charge.cs

示例2: Tbl_PetLevel_Record

	public Tbl_PetLevel_Record(XmlElement _element)
	{
		try{
			XmlNode node = (XmlElement)_element;
			SetAttribute(ref m_StarGrade, node, "StarGrade");

			XmlNodeList nodes = node.ChildNodes;
			foreach(XmlNode node1 in nodes)
			{
				int lv = 1; int exp = 0; int passive = 0; int active = 0; int special = 0;

				SetAttribute(ref lv, node1, "Level");
				SetAttribute(ref exp, node1, "Exp");
				SetAttribute(ref passive, node1, "PassiveSkillLv");
				SetAttribute(ref active, node1, "ActiveSkillLv");
				SetAttribute(ref special, node1, "SpecialSkillLv");

				m_listData.Add(lv, new PetLevelData(lv, exp, passive, active, special));
			}
		}
		catch(System.Exception e)
		{
			Debug.LogError(e);
		}
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:25,代码来源:Tbl_PetLevel.cs

示例3: checkAppearanceFieldList

 /// <summary>
 /// cycle for normal items
 /// </summary>
 /// <param name="g"></param>
 /// <param name="importingElemList"></param>
 private void checkAppearanceFieldList(XmlElement g, List<ImportingElement> importingElemList)
 {
     XmlNodeList groupElements = g.ChildNodes;
     Debug.WriteLine("Found " + groupElements.Count + " elements in this group");
     for (int j = 0; j < groupElements.Count; j++)
     {
         if (groupElements.Item(j).Name == "input")
         {
             Debug.WriteLine("Found an input node");
             XmlElement node = (XmlElement)groupElements.Item(j);
             ImportingElement importingElem = checkAttributesRefInput(node);
             importingElemList.Add(importingElem);
         }
         if (groupElements.Item(j).Name == "select")
         {
             Debug.WriteLine("Found a select node");
             XmlElement node = (XmlElement)groupElements.Item(j);
             ImportingElement importingElem = checkAttributesRefSelect(node);
             importingElemList.Add(importingElem);
         }
         if (groupElements.Item(j).Name == "select1")
         {
             Debug.WriteLine("Found a select1 node");
             XmlElement node = (XmlElement)groupElements.Item(j);
             ImportingElement importingElem = checkAttributesRefSelect1(node);
             if (importingElem.typeAttribute != "currency")
                 importingElemList.Add(importingElem);
         }
     }
 }
开发者ID:WFPVAM,项目名称:GRASPReporting,代码行数:35,代码来源:ImportFormPrototype.aspx.cs

示例4: Rot

 //! initializes from passed-in xml element, in format <someelement x="..." y="..." z="..." s="..."/>
 public Rot( XmlElement xmlelement )
 {
     x = Convert.ToDouble( xmlelement.GetAttribute( "x" ) );
         y = Convert.ToDouble( xmlelement.GetAttribute( "y" ) );
         z = Convert.ToDouble( xmlelement.GetAttribute( "z" ) );
         s = Convert.ToDouble( xmlelement.GetAttribute( "s" ) );
 }
开发者ID:hughperkins,项目名称:SpringMapDesigner,代码行数:8,代码来源:Rot.cs

示例5: ParseElement

    public override void ParseElement(XmlElement element)
    {
        string tmpArgVal = "";

        tmpArgVal = element.GetAttribute("type");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            if (tmpArgVal.Equals("none"))
                transition.setType(Transition.TYPE_NONE);
            else if (tmpArgVal.Equals("fadein"))
                transition.setType(Transition.TYPE_FADEIN);
            else if (tmpArgVal.Equals("vertical"))
                transition.setType(Transition.TYPE_VERTICAL);
            else if (tmpArgVal.Equals("horizontal"))
                transition.setType(Transition.TYPE_HORIZONTAL);
        }

        tmpArgVal = element.GetAttribute("time");
        if (!string.IsNullOrEmpty(tmpArgVal))
        {
            transition.setTime(long.Parse(tmpArgVal));
        }

        animation.getTransitions().Add(transition);
    }
开发者ID:Synpheros,项目名称:eAdventure4Unity,代码行数:25,代码来源:TransitionSubParser_.cs

示例6: Tbl_Promotion_Record

	public Tbl_Promotion_Record( XmlElement _element)
	{
		try
		{
			XmlNode node = (XmlElement)_element;

			SetValue( ref m_Index, node, "Index");
			SetValue( ref m_Priority, node, "Priority");
			SetValue<Def_Promotion.eCondition>( ref m_Condition, node, "Condition");
			SetValue<eCLASS>( ref m_Class, node, "Class");

			SetValue( ref m_Level_Min, node, "Level_Min");
			SetValue( ref m_Level_Max, node, "Level_Max");
			SetValue( ref m_Item_Index, node, "Item_Index");
			SetValue( ref m_String_Index, node, "String_Index");

			SetValue<eCashStoreMenuMode>( ref m_Miracle_Page, node, "Miracle_Page");

			SetValue( ref m_PromotionTime, node, "PromotionTime");
			SetValue( ref m_Probability, node, "Probability");
			SetValue( ref m_SubCategory, node, "Sub_Category");
			
		}
		catch( System.Exception e)
		{
			Debug.LogError( e);
		}
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:28,代码来源:Tbl_Promotion.cs

示例7: Test

        public void Test()
        {

            XmlElement xmlElement = new XmlElement("TestXml");
            XmlElement xmlElement1 = new XmlElement("ChlidElement1");
            xmlElement1.AddAttribute(new XmlAttribute("test", "12"));
            XmlElement addElement = xmlElement.AddElement(xmlElement1);
            string innerXml = xmlElement.InnerXml;
            string outterXml = xmlElement.OutterXml;
            XmlElement xmlElements = xmlElement.ChlidElements["ChlidElement1"][0];
            XmlElement element = xmlElement.Find(x => Equals(x.ElementName, "ChlidElement1"));
            // element = xmlElement.Find(@"\XML\@aa");
            XmlAttribute xmlAttributes = xmlElement1.Attributes["test"];
            XmlAttribute xmlAttribute = new XmlAttribute("name", "lsong");
            xmlElement.AddAttribute(xmlAttribute);

            XmlDocument xmlDocument = new XmlDocument(xmlElement);
            xmlDocument.SetRootElement(xmlElement);
            xmlDocument.SetVersion(new Version(1, 0, 0, 0));
            xmlDocument.Encoding = System.Text.Encoding.UTF8;
            xmlDocument.Save("c:\\temp.xml");

            xmlDocument.Load("c:\\temp.xml");
            //xmlDocument.LoadXml("<xml />");
            XmlElement rootElement = xmlDocument.RootElement;
        }
开发者ID:marinehero,项目名称:ThinkAway.net,代码行数:26,代码来源:XmlTest.cs

示例8: GenerateXml

	public static void GenerateXml()
	{
		Debug.Log("Processing..");
		enXml = new XmlDocument();
		ruXml = new XmlDocument();

		XmlUtil.xmlId = 0;

		string enXmlPath = String.Format(@"{0}\{1}", Application.dataPath, "data_en.xml");
		string ruXmlPath = String.Format(@"{0}\{1}", Application.dataPath, "data_ru.xml");

		if(File.Exists(enXmlPath))
		{
			enXml.Load(enXmlPath);
			ruXml.Load(ruXmlPath);

			XmlUtil.ruRootNode = (XmlElement)ruXml.FirstChild;
			XmlUtil.enRootNode = (XmlElement)enXml.FirstChild;
		}
		else
		{
			XmlUtil.enRootNode = (XmlElement)enXml.AppendChild(enXml.CreateElement("document"));
			XmlUtil.ruRootNode = (XmlElement)ruXml.AppendChild(ruXml.CreateElement("document"));
		}
		string startSearchPath = Application.dataPath;
		XmlUtil.GetAssets(startSearchPath); ///--- путь к ассетам
		XmlUtil.enXml.Save("data_en.xml");
		XmlUtil.ruXml.Save("data_ru.xml");
	}
开发者ID:vlad123kuznetsov,项目名称:Locator,代码行数:29,代码来源:XmlUtil.cs

示例9: readStringFromAttribute

 private string readStringFromAttribute(XmlElement element, String attribute)
 {
     if(element.HasAttribute(attribute)) {
         return element.Attributes[attribute].Value;
     }
     return null;
 }
开发者ID:andreino7,项目名称:rehabilitation-avatar,代码行数:7,代码来源:MenuSettings.cs

示例10: Tbl_Pet_Record

	public Tbl_Pet_Record(XmlElement _element)
	{
		try{
			XmlNode node = (XmlElement)_element;
			
			SetValue(ref m_Index, node, "PetID");
			SetValue(ref m_Name, node, "Name");
			SetValue(ref m_Desc, node, "Desc");
			SetValue(ref m_StarGrade, node, "StarGrade");

			SetValue(ref m_PersonGroupID, node, "PersonGroupID");
			SetValue(ref m_PassiveGroupID, node, "PassiveGroupID");
			SetValue(ref m_ActiveGroupID, node, "ActiveGroupID");
			SetValue(ref m_SpecialGroupID, node, "SpecialGroupID");
			SetValue(ref m_UpgradeID, node, "UpgradeID");
			SetValue(ref m_Class, node, "Class");

			SetValue(ref m_Icon, node, "Icon");
			SetValue(ref m_Model, node, "Model");
		}
		catch(System.Exception e)
		{
			Debug.LogError(e);
		}
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:25,代码来源:Tbl_PetData.cs

示例11: Tbl_Production_Record

	public Tbl_Production_Record(XmlElement _element)
	{
		try
		{
			XmlNode node = (XmlElement)_element;
			
			SetValue(ref m_iIndex, node, "Index");	
			SetValue<eITEM_PRODUCT_TECHNIQUE_TYPE>(ref m_type, node, "Production_Technic");
			
			SetValue(ref m_iLevel, node, "Production_Level");	
			SetValue(ref m_iItemID, node, "Production_Item_ID1");	
			SetValue(ref m_iItemCount, node, "Production_Item_Count1");	
			SetValue(ref itemTime, node, "Production_Item_Time");	
			itemTime *= 0.001f;
			SetValue(ref iExpertism , node, "Production_Item_Expertism");	
			SetValue(ref iExp , node, "Production_Item_EXP");	
			SetValue(ref iGold , node, "Production_Item_Gold");	
			SetValue(ref iBaseID , node, "Production_Item_Base");	
			SetValue(ref iBaseCount , node, "Production_Item_BaseCount");	
			SetValue(ref iSubID_1 , node, "Production_Item_Sub");	
			SetValue(ref iSubCount_1 , node, "Production_Item_SubCount");	
			SetValue(ref iSubID_2 , node, "Production_Item_Sub2");	
			SetValue(ref iSubCount_2 , node, "Production_Item_Sub2Count");	
			SetValue(ref iOpID , node, "Production_Item_Op");	
			SetValue(ref iOpCount , node, "Production_Item_OpCount");	
			SetValue(ref miracle, node, "Production_Item_Miracle");
			
		}
		catch(System.Exception e)
		{
			Debug.LogError(e);
		}
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:33,代码来源:Tbl_ProductionTable.cs

示例12: MonsterLineData

	public MonsterLineData( XmlElement _element)
	{
		try
		{
			XmlNode node = (XmlElement)_element;
			
			SetValue( ref groupIndex, node, "Index");
			SetValue( ref eType, node, "BallonCondition");
			SetValue( ref conditionValue, node, "BallonValue");
			SetValue( ref probability, node, "BallonProb");
			SetValue( ref lineIndex1, node, "BallonString1");
			SetValue( ref lineIndex2, node, "BallonString2");
			SetValue( ref lineIndex3, node, "BallonString3");
			
			if( int.MaxValue == lineIndex2)
				lineIndex2 = lineIndex1;
			
			if( int.MaxValue == lineIndex3)
				lineIndex3 = lineIndex1;
		}
		catch( System.Exception e)
		{
			Debug.LogError(e);
		}
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:25,代码来源:AsMonsterLineManager.cs

示例13: parse

            /// <summary>
            /// 从 body 字符串中解析,成功返回 true,否则 false
            /// </summary>
            /// <param name="str">body字符串</param>
            /// <param name="command">出参,对应 command 属性</param>
            /// <param name="cmd_node">出参,对应整个 cmd 节点</param>
            /// <param name="mcu_jid">出参,mcu jid</param>
            /// <param name="mcu_cid">出参,mcu cid</param>
            /// <returns></returns>
            public static bool parse(string str, out string command, out XmlElement cmd_node, out string mcu_jid, out int mcu_cid)
            {
                command = null;
                cmd_node = null;
                mcu_cid = 0;
                mcu_jid = null;

                try
                {
                    XmlDocument doc = new XmlDocument();
                    doc.LoadXml(str);

                    XmlElement node_zonekey = doc.DocumentElement;
                    if (node_zonekey.Name == "zonekey")
                    {
                        XmlNode node_app = node_zonekey.Attributes.GetNamedItem("app");
                        if (node_app != null && node_app.NodeType == XmlNodeType.Attribute && ((XmlAttribute)node_app).Value == "record_livingcast_service")
                        {
                            // 找到 cmd 节点,和 mcu 节点
                            XmlNodeList cmds = doc.SelectNodes("/zonekey/cmd");
                            XmlNodeList mcus = doc.SelectNodes("/zonekey/mcu");

                            if (cmds.Count >= 1 && mcus.Count >= 1)
                            {
                                cmd_node = (XmlElement)cmds[0];
                                XmlElement mcu_node = (XmlElement)mcus[0];

                                XmlNode attr_command = cmd_node.Attributes.GetNamedItem("command");
                                if (attr_command != null)
                                {
                                    command = attr_command.Value;

                                    int state = 0;
                                    foreach (XmlNode cn in mcu_node.ChildNodes)
                                    {
                                        if (cn.Name == "jid")
                                        {
                                            mcu_jid = cn.InnerText;
                                            state |= 1;
                                        }
                                        else if (cn.Name == "cid")
                                        {
                                            mcu_cid = int.Parse(cn.InnerText);
                                            state |= 2;
                                        }
                                    }

                                    return state == 3;  // 拥有 mcu_jid, mcu_cid
                                }
                            }
                        }
                    }

                    return false;
                }
                catch
                {
                    return false;
                }
            }
开发者ID:FihlaTV,项目名称:conference,代码行数:69,代码来源:Utility.Parser.cs

示例14: Tbl_Lottery_Record

	public Tbl_Lottery_Record(XmlElement _element)
	{
		
		System.Text.StringBuilder sbTemp = new System.Text.StringBuilder();
		
		try
		{
			XmlNode node = (XmlElement)_element;
		
			SetValue( ref Index, node, "Index" );
			SetValue( ref m_NeedEffect, node, "Eff_type" );			
			for( int i=1; i<=10; ++i )
			{
				int _iIndex = 0;
				sbTemp.Length = 0;
				sbTemp.Append( "Rand_ID" );
				sbTemp.Append( i );
				SetValue( ref _iIndex, node, sbTemp.ToString() );
				
				if( 0 != _iIndex && int.MaxValue != _iIndex )
				{
					idlist.Add( _iIndex ); 
				}
				else 
					break;
			}		
					
		}
		catch(System.Exception e)
		{
			Debug.LogError("[Tbl_Lottery_Record] 'constructor': |" + e.ToString() + "| error while parsing");
		}
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:33,代码来源:Tbl_LotteryTable.cs

示例15: Tbl_UserLevel_Record

	public Tbl_UserLevel_Record(XmlElement _element)// : base(_element)
	{
		try{
			XmlNode node = (XmlElement)_element;
			
			SetValue(ref m_Index, node, "Index");
			SetValue<eCLASS>(ref m_Class, node, "Class");
			SetValue(ref m_Level, node, "Level");
			SetValue(ref m_TotalEXP, node, "TotalEXP");
			SetValue(ref m_HPMax, node, "HPMax");
			SetValue(ref m_MPMax, node, "MPMax");
			SetValue(ref m_PhysicalAttack_Min, node, "PhysicalAttack_Min");
			SetValue(ref m_PhysicalAttack_Max, node, "PhysicalAttack_Max");
			SetValue(ref m_PhysicalDefense, node, "PhysicalDefense");
			SetValue(ref m_MagicalAttack_Min, node, "MagicalAttack_Min");
			SetValue(ref m_MagicalAttack_Max, node, "MagicalAttack_Max");
			SetValue(ref m_MagicalResist, node, "MagicalResist");
			SetValue(ref m_Resurrection_Cost, node, "Resurrection_Cost");
			
			SetValue(ref m_Lv_Bonus, node, "Lv_Bonus");
			SetValue(ref m_Lv_BonusCount, node, "Lv_BonusCount");
		}
		catch(System.Exception e)
		{
			Debug.LogError(e);
		}
	}
开发者ID:ftcaicai,项目名称:ArkClient,代码行数:27,代码来源:Tbl_UserLevel.cs


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