【发布时间】:2009-06-15 09:54:32
【问题描述】:
嗨社区我有以下问题,
给定这个 xml
<test>
<comp>
<id>1</id>
<content>bar</content>
</comp>
<comp>
<id>2</id>
<content>foo</content>
</comp>
</test>
我想更改 id 为 2 的 comp 元素内容的值。因此我使用 foreach 循环进行循环
for each (var x : XML in testXML.children()) {
if (x.id == 2) {
for each (var element : XML in x.Children()) {
if (element.localName() == "content") {
element = "new content";
}
}
}
}
现在当到达element = "new content"; 点时,我的程序告诉我我不能给元素新内容的值,因为这是一个字符串,而元素是 xml。我怎样才能做到这一点?
提前致谢
塞巴斯蒂安
【问题讨论】:
-
好的,刚刚发现...我使用了 element.* = "new content" 现在它可以工作了
标签: xml apache-flex actionscript-3