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.

相关文章

php输出xml格式字符串
J2ME Mobile 3D入门教程系列文章之一
XML轻松学习手册
XML入门的常见问题(一)
XML入门的常见问题(三)
XML轻松学习手册(2)XML概念