以文本方式查看主题

-  中文XML论坛 - 专业的XML技术讨论区  (http://bbs.xml.org.cn/index.asp)
--  『 DOM/SAX/XPath 』  (http://bbs.xml.org.cn/list.asp?boardid=11)
----  一个xpath的问题  (http://bbs.xml.org.cn/dispbbs.asp?boardid=11&rootid=&id=34800)


--  作者:102niu
--  发布时间:6/23/2006 7:41:00 AM

--  一个xpath的问题
有如下的一个xml文件
<?xml version="1.0" encoding="gb2312"?>
<AccountInfo version="1.0.0">
    <account>
        <id>1000</id>
    </account>
    <account>
        <id>2000</id>
    </account>
    <account>
        <id>3000</id>
    </account>
    <account>
        <id>3007</id>
    </account>
    <count>3</count>
</AccountInfo>
现在想要先查询出account/id值为3000的节点,然后在此节点下添加一个新的节点account/status,最后生成如下的xml表
<AccountInfo version="1.0.0">
    <account>
        <id>1000</id>
    </account>
    <account>
        <id>2000</id>
    </account>
    <account>
        <id>3000</id>
    </account>
    <account>
        <id>3007</id>
        <status>True</status>
    </account>
    <count>3</count>
</AccountInfo>
应该怎么实现呢?
--  作者:Qr
--  发布时间:6/23/2006 8:41:00 AM

--  
http://bbs.w3china.org/dispbbs.asp?boardID=1&ID=34679
W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
62.500ms