是否可以使用 simplexml 更新 xml 的节点属性?示例:-我的程序实际上是老师的测验编辑器,作为老师,我想编辑特定的问题属性。IE
<Quiz>
<topic text="Preparation for Exam">
<subtopic text="Math">
<question text="1 + 1 = ?">
<answer num="A" Text="1" />
<answer num="B" Text="2" />
<answer num="C" Text="3" />
<answer num="D" Text="4" />
</question>
<question text="4 * 4 = ?" >
<answer num="A" Text="12" />
<answer num="B" Text="14" />
<answer num="C" Text="16" />
<answer num="D" Text="18" />
</question>
</subtopic>
</topic>
</Quiz>
可能吗?虽然我尝试了很多方法,即删除前一个节点,然后插入已编辑的节点。但是这个技巧只适用于最后一个节点......对于其他节点它只是交换