<location>
<hotspot name="name1" X="444" Y="518" />
<hotspot name="name2" X="542" Y="452" />
<hotspot name="name3" X="356" Y="15" />
</location>
我有一个点变量,我需要选择其坐标的节点,然后更改属性值。我想要做类似的事:
I have a point variable and I need to select the node with its coordinates, then change an attribute value. I want to do something similar to:
let node = xmld.SelectSingleNode("/location/hotspot[@X='542' @Y='452']")
node.Attributes.[0].Value <- "new_name2"
而是一个变量取属性值(variable_name.X / variable_name.Y)。
but taking attributes value by a variable (variable_name.X / variable_name.Y).
这是很容易的。假如我要修改的第一个属性在我的节点:
It was really easy. Supposing I want to modify the first attribute in my node:
let node = xmld.SelectSingleNode("/location/hotspot[@X='" + string(current.X) + "'] [@Y='" + string(current.Y) + "']")
node.Attributes.[0].Value <- v
在这里当前是我的变量;)
where "current" is my variable ;)
上一篇:是否有一个通用的具体实施KeyedCollection的?具体实施、有一个、KeyedCollection
下一篇:.NET 3.5:读取的app.config的ConnectionString?NET、app、ConnectionString、config