Tom*_*ger 5 xml sap abap xml-deserialization
我有未知结构的XML,我想在它上面应用ST(简单转换),以"某种方式"将XML中的内容转换为ABAP结构.
现在我有以下测试报告:
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.
Run Code Online (Sandbox Code Playgroud)
我跟随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>
Run Code Online (Sandbox Code Playgroud)
现在它工作正常,它会将ID带入表LT_OBJ的字段中.然而由于使用,其余部分被忽略<TT:SKIP>
.我的目标是将剩余的XML文档(这些FIRST,SECOND,HERE和THERE或任意XML)以"某种"格式存入字段REST - 可能是存储在STRING变量中的粗略XML.
我明白我需要<TT:SKIP>
用更聪明的东西来代替,但我无法弄明白应该是什么......任何想法?
旁注:是的,我知道,最好使用XSLT或其他东西,而不是ST,但我别无选择,我需要使用ST.
归档时间: |
|
查看次数: |
4313 次 |
最近记录: |