以文本方式查看主题

-  W3CHINA.ORG讨论区 - 语义网·描述逻辑·本体·RDF·OWL  (http://bbs.xml.org.cn/index.asp)
--  『 XQuery/XLink/XPointer/ 』  (http://bbs.xml.org.cn/list.asp?boardid=14)
----  [求助]如何将两个节点的内容合并呢?  (http://bbs.xml.org.cn/dispbbs.asp?boardid=14&rootid=&id=122766)


--  作者:allenlalala
--  发布时间:12/3/2011 7:13:00 PM

--  [求助]如何将两个节点的内容合并呢?
源代码如下:
<soapenv:Envelope  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   </soap:Header>
     <soap:Body  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
       <ns2:listdeptqueryResponse  xmlns:ns2="http://www.alsb.com/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
          <return>
                <age>1</age>
                <name>1</name>
          </return>
          <return>
                <age>2</age>
                <name>2</name>
          </return>
       </ns2:listdeptqueryResponse>
       <ns2:listqueryResponse  xmlns:ns2="http://www.alsb.com/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
         <return>
               <age>4</age>
              <name>4</name>
        </return>
        <return>
              <age>5</age>
              <name>5</name>
        </return>
       </ns2:listqueryResponse>
    </soap:Body>
</soapenv:Envelope>

我想把这段代码处理成类似下面这种结构,就是将原来listdeptqueryResponse和listqueryResponse的内容整合到一个节点内,节点名字无所谓,应该如何写Xquery呢?
<soapenv:Envelope  xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Header  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   </soap:Header>
     <soap:Body  xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
       <ns2:listdeptqueryResponse  xmlns:ns2="http://www.alsb.com/" xmlns:S="http://schemas.xmlsoap.org/soap/envelope/">
          <return>
                <age>1</age>
                <name>1</name>
          </return>
          <return>
                <age>2</age>
                <name>2</name>
          </return>
           <return>
               <age>4</age>
              <name>4</name>
        </return>
        <return>
              <age>5</age>
              <name>5</name>
        </return>
       </ns2:listdeptqueryResponse>
    </soap:Body>
</soapenv:Envelope>
请各位朋友指教,小女子感激不尽~



W 3 C h i n a ( since 2003 ) 旗 下 站 点
苏ICP备05006046号《全国人大常委会关于维护互联网安全的决定》《计算机信息网络国际联网安全保护管理办法》
46.875ms