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


C# XmlNode.SelectNodes方法代码示例

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


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

示例1: MenuElement

    public MenuElement(XmlNode node)
    {
        this.bundleName = node.Attributes["assetBundle"].Value;

        XmlNodeList cs = node.SelectNodes("//c");
        foreach (XmlNode c in cs){
            sources.Add(c.Attributes["src"].Value);
        }
        cs = node.SelectNodes("//img");
        foreach (XmlNode c in cs){
            if (c.Attributes["src"] != null)
                sources.Add(c.Attributes["src"].Value);
        }
        cs = node.SelectNodes("//spot");
        foreach (XmlNode c in cs){
            if (c.Attributes["src"] != null)
                sources.Add(c.Attributes["src"].Value);
        }

        // timeline
        cs = node.SelectNodes("//ms");
        if (cs.Count > 0){
            sources.Add("timelinebg");
            sources.Add("timelinearrow");
            foreach (XmlNode c in cs){
                sources.Add(c.Attributes["time"].Value);
                sources.Add(c.Attributes["text"].Value);
                sources.Add(c.Attributes["pic"].Value);
            }
        }
    }
开发者ID:meekr,项目名称:Haima,代码行数:31,代码来源:MenuElement.cs

示例2: RunFileAction

	private static bool RunFileAction (XmlNode fileElement)
	{
		string path = GetAttribute (fileElement, "Path");
		XmlDocument doc = new XmlDocument ();
		try {
			doc.Load (path);
		} catch {
			Console.WriteLine ("ERROR: Could not open {0}.", path);
			return false;
		}
		
		Console.WriteLine ("Processing {0}...", path);
		
		foreach (XmlNode element in fileElement.SelectNodes ("Replace"))
			if (!ReplaceNode (fileElement.OwnerDocument, doc, element))
				return false;
		
		foreach (XmlNode element in fileElement.SelectNodes ("Insert"))
			if (!InsertNode (fileElement.OwnerDocument, doc, element))
				return false;
		
		foreach (XmlNode element in fileElement.SelectNodes ("Remove"))
			if (!RemoveNodes (doc, element))
				return false;
		
		doc.Save (path);
		Console.WriteLine ("{0} saved.", path);
		return true;
	}
开发者ID:JohnThomson,项目名称:taglib-sharp,代码行数:29,代码来源:XmlInjector.cs

示例3: ParseMap

    private void ParseMap(XmlNode mapNode)
    {
        var tilesetsXmlNodeList = mapNode.SelectNodes("tileset");
        if (tilesetsXmlNodeList != null) ParseTileSets(tilesetsXmlNodeList);
        else Debug.LogError("Unable to parse the map file, no <tileset> element found for <map>.");

        var tilellayerXmlNodeList = mapNode.SelectNodes("layer");
        if (tilellayerXmlNodeList != null) ParseTileLayers(tilellayerXmlNodeList);
        else Debug.LogError("Unable to parse the map file, no <layer> element found for <map>.");

        //_mapLoaded = true;
        Debug.Log("Parsed map.");
    }
开发者ID:kjellski,项目名称:UnityFluidRTS,代码行数:13,代码来源:TileMap.cs

示例4: checkHave

 private static bool checkHave(XmlNode haveReq)
 {
     int haveQuantity = UserProperty.GetPropNode(haveReq.getString()).GetInt();
     foreach (XmlNode atLeast in haveReq.SelectNodes(AT_LEAST)) {
         if (MathData.GetInt(atLeast) > haveQuantity) {
             return false;
         }
     }
     foreach (XmlNode exactly in haveReq.SelectNodes(EXACTLY)) {
         if (MathData.GetInt(exactly) != haveQuantity) {
             return false;
         }
     }
     return true;
 }
开发者ID:CalPolyGameDevelopment,项目名称:ettell,代码行数:15,代码来源:Requirements.cs

示例5: loadPromoters

    public bool loadPromoters(XmlNode node, LinkedList<IReaction> reactions)
    {
        XmlNodeList promotersList = node.SelectNodes("promoter");
        bool b = true;

        foreach (XmlNode promoter in promotersList)
          {
        Promoter p = new Promoter();
        foreach (XmlNode attr in promoter)
          {
            switch (attr.Name)
              {
              case "name":
                b = b && loadPromoterName(attr.InnerText, p);
                break;
              case "productionMax":
                b = b && loadPromoterProductionMax(attr.InnerText, p);
                break;
              case "terminatorFactor":
                b = b && loadPromoterTerminatorFactor(attr.InnerText, p);
                break;
              case "formula":
                b = b && loadPromoterFormula(attr.InnerText, p);
                break;
              case "operon":
                b = b && loadPromoterOperon(attr, p);
                break;
              }
          }
        reactions.AddLast(p);
          }
        return b;
    }
开发者ID:CyberCRI,项目名称:DsynBio,代码行数:33,代码来源:PromoterLoader.cs

示例6: Deserialize

    public static SkillData Deserialize(XmlNode dataui, XmlNode data)
    {
        SkillData _SkillData = ScriptableObject.CreateInstance<SkillData>();
        _SkillData.Name = dataui.Attributes["name"].Value;
        _SkillData.Id = int.Parse(dataui.Attributes["id"].Value);

        //=========变量初始化
        XmlNodeList childs = data.SelectNodes("variables/var");
        foreach (XmlNode child in childs)
        {
            SharedVariable sharedVariable = ScriptableObject.CreateInstance(string.Format("Shared{0}",child.Attributes["type"].Value )) as SharedVariable;
            sharedVariable.name = child.Attributes["name"].Value;
            sharedVariable.IsShared = true;
            _SkillData.Variables.Add(sharedVariable.name,sharedVariable);
        }

        //==========模块初始化
        List<Task> list = new List<Task>();
        childs = dataui.SelectNodes("item");
        foreach (XmlNode child in childs)
        {
            string k = child.Attributes["ID"].Value;

            XmlNode k1 = data.SelectSingleNode(@"*[@id=" + k + "]");

            Task tk = DeserializeTask(child, k1, _SkillData);
            list.Add(tk);

        }
        _SkillData.Datas = list;
        return _SkillData;
    }
开发者ID:webconfig,项目名称:Design,代码行数:32,代码来源:DeserializeXml.cs

示例7: loadInstantReactions

    public bool loadInstantReactions(XmlNode node, LinkedList<IReaction> reactions)
    {
        XmlNodeList IReactionsList = node.SelectNodes("instantReaction");
        bool b = true;

        foreach (XmlNode IReaction in IReactionsList)
          {
        InstantReaction ir = new InstantReaction();
        foreach (XmlNode attr in IReaction)
          {
            switch (attr.Name)
              {
              case "name":
                ir.setName(attr.InnerText);
                break;
              case "reactants":
                loadInstantReactionReactants(attr, ir);
                break;
              case "products":
                loadInstantReactionProducts(attr, ir);
                break;
              }
          }
        reactions.AddLast(ir);
          }
        return b;
    }
开发者ID:CyberCRI,项目名称:DsynBio,代码行数:27,代码来源:InstantReactionLoader.cs

示例8: ReadFromXMLNode

            public virtual void ReadFromXMLNode(XmlNode node)
            {
                try
                {
                    // Read the pylons models
                    XmlNodeList cableStates = node.SelectNodes(ModelXMLDefinition.CableState);
                    foreach (XmlNode cableState in cableStates)
                    {
                        CCableState normalNode = new CCableState(this, new CCablingConnectionIndicator(new CLineTwoPointsIndicatorsImpl()));
                        normalNode.ReadFromXMLNode(cableState);
                    }

                    //// Set active cable state to the first one if it exists
                    //if (CableStates != null && CableStates.Count != 0)
                    //{
                    //    ActiveCableState = CableStates[0];
                    //}

                    // Read the cable switch condition
                    XmlNode cableConditionNode = node.SelectSingleNode(ModelXMLDefinition.CableSwitchCondition);
                    if (cableConditionNode != null)
                    {
                        m_cableSwitchCondition = CCableSwitchConditionFactory.ReadFromXMLNode(cableConditionNode, this);
                    }
                }
                catch (SystemException ex)
                {
                    string errMsg = "Read cable data failed:\n" + ex.Message + "\n" + ex.StackTrace;
                    vtk.vtkOutputWindow.GetInstance().DisplayErrorText(errMsg);
                    throw;
                }
            }
开发者ID:unidevop,项目名称:sjtu-project-pipe,代码行数:32,代码来源:cableModels.cs

示例9: RGBTreePreviewDialog

    public RGBTreePreviewDialog(XmlNode setupNode, IList<Channel> channels)
    {
        InitializeComponent();

        if (null == setupNode || null == setupNode.Attributes || null == setupNode.Attributes["from"] ||
            null == setupNode.SelectNodes("Channels/Channel")) {
            throw new NullReferenceException("setupNode has a null value in a non-null field");
        }

        Width = ParseNode(setupNode.SelectSingleNode("Settings/Width"), Screen.PrimaryScreen.WorkingArea.Width);
        Height = ParseNode(setupNode.SelectSingleNode("Settings/Height"), Screen.PrimaryScreen.WorkingArea.Width);
        _drawSize = ParseNode(setupNode.SelectSingleNode("Settings/PixelSize"), DrawSizeDefault);

        ClientSize = new Size(Width, Height);
        pictureBox.Size = new Size(Width, Height);

        // Checked above stupid resharper.
        // ReSharper disable once PossibleNullReferenceException
        var startChannel = int.Parse(setupNode.Attributes["from"].Value) - 1;
        _channelDictionary = new Dictionary<int, List<uint>>();

        // Checked above stupid resharper.
        // ReSharper disable once PossibleNullReferenceException
        foreach (XmlNode xmlNode in setupNode.SelectNodes("Channels/Channel")) {
            if (xmlNode.Attributes == null) {
                continue;
            }

            var channelNumber = Convert.ToInt32(xmlNode.Attributes["number"].Value);

            if (channelNumber < startChannel) {
                continue;
            }

            var outputChannel = new List<uint>();
            var encodedChannelData = Convert.FromBase64String(xmlNode.InnerText);

            var startIndex = 0;
            while (startIndex < encodedChannelData.Length) {
                outputChannel.Add(BitConverter.ToUInt32(encodedChannelData, startIndex));
                startIndex += 4;
            }
            _channelDictionary[channels[channelNumber - startChannel].OutputChannel] = outputChannel;
        }
    }
开发者ID:jmcadams,项目名称:vplus,代码行数:45,代码来源:RGBTreePreviewDialog.cs

示例10: ParseTileLayer

    /// <summary>
    /// Parses the example xml element structure to an object of this type:
    /// <note>
    ///     <layer name="background" width="20" height="20">
    ///         <data>
    ///             <tile gid="1"/>
    ///             ...
    ///         </data>
    ///     </layer>
    /// </note>
    /// </summary>
    /// <param name="tileLayerXmlNode"></param>
    /// <param name="map"></param>
    /// <returns></returns>
    public static TileLayer ParseTileLayer(XmlNode tileLayerXmlNode, TileMap map)
    {
        int widht = int.Parse(tileLayerXmlNode.Attributes["width"].Value);
        int height = int.Parse(tileLayerXmlNode.Attributes["height"].Value);
        string name = tileLayerXmlNode.Attributes["name"].Value;
        Tile[,] data = ParseTiles(tileLayerXmlNode.SelectNodes("data/tile"), map, widht, height);

        return new TileLayer(widht, height, name, data);
    }
开发者ID:kjellski,项目名称:UnityFluidRTS,代码行数:23,代码来源:TileLayer.cs

示例11: Get_Random_User

 public string Get_Random_User()
 {
     summon_db.Load("Assets/Scripts/Grimoire/Database/SummonDatabase.xml");
     summon_root = summon_db.DocumentElement;
     XmlNodeList users = summon_root.SelectNodes("//Summon");
     XmlNode random_user = users[UnityEngine.Random.Range(0, users.Count)];
     string name = random_user.Attributes.Item(0).Value;
     return name;
 }
开发者ID:Higure27,项目名称:Grimoire,代码行数:9,代码来源:GrimoireDatabase.cs

示例12: checkHave

 private static bool checkHave(XmlNode haveReq)
 {
     int haveQuantity = int.Parse(UserProperty.getProp(haveReq.Attributes[XmlUtilities.data].Value));
     foreach (XmlNode atLeast in haveReq.SelectNodes(XmlUtilities.atLeast)) {
         if (int.Parse(atLeast.Attributes[XmlUtilities.data].Value) > haveQuantity) {
             return false;
         }
     }
     return true;
 }
开发者ID:foxor2,项目名称:attell,代码行数:10,代码来源:Requirements.cs

示例13: apply

 public static void apply(XmlNode consequence)
 {
     foreach (XmlNode change in consequence.SelectNodes(CHANGE)) {
         string changeProp = change.getString();
         foreach (XmlNode add in change.SelectNodes(ADD)) {
             int delta = MathData.GetInt(add);
             UserProperty.setProp(changeProp,
                 (UserProperty.GetPropNode(changeProp).GetInt() + delta).ToString()
             );
         }
         foreach (XmlNode mult in change.SelectNodes(MULTIPLY)) {
             int factor = MathData.GetInt(mult);
             UserProperty.setProp(changeProp,
                 (UserProperty.GetPropNode(changeProp).GetInt() * factor).ToString()
             );
         }
     }
     foreach (XmlNode newNameNode in consequence.SelectNodes(LEARN_NAME)) {
         string newName = newNameNode.getString();
         foreach (string oldName in newNameNode.childNode(BEFORE_CALLED).getStrings()) {
             Regex regex = new Regex(string.Format("^({0}):", oldName));
             foreach (string setting in newNameNode.childNode(APPEARS_IN).getStrings()) {
                 XmlNode uProp = UserProperty.GetPropNode(setting);
                 foreach (XmlNode replaceable in uProp.GetStringNodes()) {
                     replaceable.SetString(regex.Replace(replaceable.getString(), delegate(Match m) {
                         return newName + ":";
                     }));
                 }
             }
         }
     }
     foreach (XmlNode addLines in consequence.SelectNodes(ADD_STRING)) {
         XmlNode dialog = UserProperty.GetPropNode(addLines.childNode(STRING_TARGET).getString());
         foreach (string line in addLines.getStrings()) {
             dialog.CreateStringNode().SetString(line);
         }
     }
     if (consequence.childNode(WIPE_USER_STATE) != null) {
         UserProperty.Wipe();
         UserProperty.ForceReload();
     }
 }
开发者ID:CalPolyGameDevelopment,项目名称:ettell,代码行数:42,代码来源:Consequences.cs

示例14: SerialiseSoundBank

 static void SerialiseSoundBank(XmlNode node)
 {
     XmlNodeList includedEvents = node.SelectNodes("IncludedEvents");
     for (int i = 0; i < includedEvents.Count; i++)
     {
         XmlNodeList events = includedEvents[i].SelectNodes("Event");
         for (int j = 0; j < events.Count; j++)
         {
             SerialiseMaxAttenuation(events[j]);
         }
     }
 }
开发者ID:colincove,项目名称:ProtoProfundum,代码行数:12,代码来源:AkWwiseXMLBuilder.cs

示例15: loadEnzymeReactions

    /*!
    \brief Load all enzymatic reactions from an xml node
    \param node The xml node
    \param reactions The list of reactions
    \return Return true if succed, false otherwise
      */
    public bool loadEnzymeReactions(XmlNode node, LinkedList<IReaction> reactions)
    {
        XmlNodeList EReactionsList = node.SelectNodes("enzyme");
        bool b = true;

        foreach (XmlNode EReaction in EReactionsList)
          {
        EnzymeReaction er = new EnzymeReaction();
        foreach (XmlNode attr in EReaction)
          {
            switch (attr.Name)
              {
              case "name":
                b = b && loadEnzymeString(attr.InnerText, er.setName);
                break;
              case "substrate":
                b = b && loadEnzymeString(attr.InnerText, er.setSubstrate);
                break;
              case "enzyme":
                b = b && loadEnzymeString(attr.InnerText, er.setEnzyme);
                break;
              case "Kcat":
                b = b && loadEnzymeFloat(attr.InnerText, er.setKcat);
                break;
              case "effector":
                b = b && loadEnzymeString(attr.InnerText, er.setEffector);
                break;
              case "alpha":
                b = b && loadEnzymeFloat(attr.InnerText, er.setAlpha);
                break;
              case "EnergyCost":
                b = b && loadEnzymeFloat(attr.InnerText, er.setEnergyCost);
                break;
              case "beta":
                b = b && loadEnzymeFloat(attr.InnerText, er.setBeta);
                break;
              case "Km":
                b = b && loadEnzymeFloat(attr.InnerText, er.setKm);
                break;
              case "Ki":
                b = b && loadEnzymeFloat(attr.InnerText, er.setKi);
                break;
              case "Products":
                b = b && loadEnzymeReactionProducts(attr, er);
                break;
              }
          }
        reactions.AddLast(er);
          }
        return b;
    }
开发者ID:quito,项目名称:DSynBio_reloaded,代码行数:57,代码来源:EnzymeReactionLoader.cs


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