我有未知结构的XML,我想对其应用ST(简单转换)以“不知何故”将内容从XML转换为ABAP结构。SAP简单转换与未知的XML
现在我有以下的测试报告:
report ztbu_st_with_copy.
data: lf_xml type string.
concatenate '<tab><obj>'
'<id>A1</id>'
'<first>Erste</first>'
'<second>Zweite</second>'
'</obj><obj>'
'<id>B2</id>'
'<item>'
'<here>Tady</here>'
'<there>Tam</there>'
'</item>'
'</obj>'
'</tab>'
into lf_xml.
types: begin of ys_obj,
id type string,
rest type string,
end of ys_obj,
yt_obj type standard table of ys_obj.
data: lt_obj type yt_obj.
call transformation ztbu_st_copy_test
source xml lf_xml
result root = lt_obj.
uline.
data: ls_obj like line of lt_obj.
loop at lt_obj into ls_obj.
write:/sy-tabix, ls_obj-id.
endloop.
uline.
,我有如下ST改造ZTBU_ST_COPY_TEST(在一个以上的称呼):
<?sap.transform simple?>
<tt:transform xmlns:tt="http://www.sap.com/transformation-templates">
<tt:root name="ROOT"/>
<tt:template>
<tab>
<tt:loop ref=".ROOT" name="obj">
<obj>
<id>
<tt:value ref="$obj.ID" />
</id>
<tt:skip />
</obj>
</tt:loop>
</tab>
</tt:template>
</tt:transform>
现在它工作正常,它会带来的ID为表LT_OBJ的字段。但其余的被忽略,因为使用<TT:SKIP>
。我的目标是以“某些”格式将剩余的XML文档(这些FIRST,SECOND,HERE和THERE或任意XML)存入REST字段 - 可能是存储在STRING变量中的粗略XML。
我知道我需要用更聪明的东西来代替<TT:SKIP>
,但我无法弄清楚应该是什么......任何想法?
附注:是的,我知道,最好是使用XSLT或其他东西,而不是ST,但我没有选择,我需要使用ST。
我不会称之为“未知的XML”。您似乎认为XML以开头,其中有一个,每个都有一个和其他未知元素。这是安全的吗? –
Eric
2013-08-16 12:38:38
是的,这是安全的假设,,和是众所周知的,但我在其余的事情后,他们是真正的未知... –
2013-08-19 20:41:37