SAP Simple Transformation with unknown XML -


i have xml of unknown structure , want apply st (simple transformation) on "somehow" content out of xml abap structures.

for have following test report:

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>'        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 line of lt_obj. loop @ lt_obj ls_obj.   write: / sy-tabix, ls_obj-id. endloop.  uline. 

and have following st transformation ztbu_st_copy_test (the 1 called above):

<?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> 

now works fine , bring ids fields of table lt_obj. rest ignored due use of <tt:skip>. goal rest of xml document (these first, second, here , there or arbitrary xml) field rest in "some" format - rough xml stored in string variable.

i understand need replace <tt:skip> smarter, can't figure out should be... idea?

side note: yes, know, better use xslt or else, instead of st, have no choice , need make using st.

if have sap developer's license, possible through sdk provided license. i've written similar using vb.net, if you're interested in samples let me know.


Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -