我的问题是,我怎么能得到该节点在女巫我要插入:
My question is, that how can I get the node in witch I want to insert:
即
<folder id="1">
<folder id="4">
<folder id="5"></folder>
</folder>
</folder>
<folder id="2">
<file id="4"/>
</folder>
<folder id="3">
</folder>
我想获得的文件夹id为4,但可以在任何水平。
I want to get folder with id = 4, but that can be on any level.
如果文件夹不能包含另一个比它会是这样MYNODE = xml.folder。(@ ID = = 4)。
If folders couldn't contain one another than it would be like this myNode = xml.folder.(@id == 4).
使用了 ..
运营商,它看起来对所有与给定名称的节点,它不不管有多深他们。例如 xml..folder
会发现所有的&LT;文件夹/&GT;
在XML节点。所以,你现在要做的将是什么 MYNODE = xml..folder。(@ ID = = 4)
。
Use the ..
operator, it looks for all the nodes with given name and it doesn't matter how deep they are. For example xml..folder
will find all the <folder/>
nodes in your XML. So what you're trying to do will be myNode = xml..folder.(@id == 4)
.