微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Abap – 遍历xml文档的整个节点?

我想遍历if_ixml_document的整个节点.这是最好的方法吗?

请查找示例文档.

<text>
    <id>
         <guid auto="false">
               432543254543
         </guid>
    </id>
     <title>
         <short_title italics="on">
                <bold language = "german">
                     "Hello"
               </bold>
        </short_title>
     </title> </text>

在本文档中,我需要遍历节点< text>,< id>,< guid>,< title>,< short_title>,< bold>等等

提前致谢

问候,
亚历克斯

解决方法

您可以找到 extensive XML manual on SAP’s documentation website(如果链接无法正常工作,请转到 help.sap.com上的Netweaver开发人员指南并搜索“xml库”).

“iXML ABAP Objects Jumpstart”一章可以让您快速入门. “迭代完整的DOM树”段落提供了以下示例代码

data: iterator type ref to if_ixml_node_iterator,node     type ref to if_ixml_node.
iterator = document->create_iterator( ).
node = iterator->get_next( ).
while not node is initial.
  * do something with the node
  ...
  node = iterator->get_next( ).
endwhile.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。