情況:我有一個XML文件(主要是大量的布爾邏輯)。我想要做什麼: 通過該節點中屬性的內部文本獲取節點的索引。然後將子節點添加到給定的索引。按屬性值獲取元素的索引
例子:
<if attribute="cat">
</if>
<if attribute="dog">
</if>
<if attribute="rabbit">
</if>
我可以得到一個給定的元素名稱
GetElementsByTagName("if");
的索引列表,但我將如何得到節點列表中的節點的索引,使用的innerText的屬性。沿
Somecode.IndexOf.Attribute.Innertext("dog").Append(ChildNode);
線條的東西
Basicly思維要這樣結束了。
<if attribute="cat">
</if>
<if attribute="dog">
<if attribute="male">
</if>
</if>
<if attribute="rabbit">
</if>
創建節點並將它插入索引,我沒有問題。只需要一種方法來獲得索引。