使用 XSLT 以外的其他解决方案解析 XML [英] Parsing XML with other solution than XSLT

查看:16
本文介绍了使用 XSLT 以外的其他解决方案解析 XML的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的公司正在开发一个需要在 ABAP 中读取 XML 文件的项目.

My company is working on a project that needs to read XML files within ABAP.

  1. 当 XML 文件没有特定标签的数据时,它会忽略该数据.
  2. 有些标签是自动关闭的.例如<标签/>

SAP 开发人员说要读取 XML 文档,他首先将文档解析为 ABAP XML 结构.此过程在第 2 点失败.然后他必须创建一个 XSLT 将该数据转换为内部数据结构,而在第 1 点失败,因此在 ABAP 中很难完成该任务.

The SAP developer says that to read the XML document he first parses the document into an ABAP XML structure. This process fails on point 2. He must then create an XSLT to turn that data into an internal data structure, and that fails on point 1 therefore making the task very difficult to achieve within ABAP.

是否确实如此,那么是否无法读取我们需要的特定字段?

Is that definitely the case and is there then no way of reading the specific fields that we need?

推荐答案

在 ABAP 中开始 XML 解析的最佳位置是 SAP XML 库.

The best place to start with XML parsing in ABAP is the SAP XML Library.

尝试编写自己的解析算法可以说是一个非常糟糕的主意 - 让其他人(在本例中为 SAP)为您完成繁重的工作.

It is arguably a really bad idea to try and write your own parsing algorithm - let someone else (SAP, in this case) do the hard work for you.

这篇关于使用 XSLT 以外的其他解决方案解析 XML的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆