‎2011 Mar 05 5:18 AM
Hello everyone,
I am trying to convert an XML string to an internal table. The format of the XML string is as follows:
<node label="Compressors" NODE_ID="783" checked="1" expandStatus="false">
<node label="Nail guns" NODE_ID="78543" checked="1" expandStatus="false"/>
<node label="Spray guns" NODE_ID="855" checked="0" expandStatus="false"/>
<node label="Cleaning equipment" NODE_ID="9" checked="1" expandStatus="false"/>
</node>
What I need is an internal table with the fields NODE_ID and checked filled. The hierarchy here doesn't matter, so I just need an internal table of a structure with 2 fields. The whole XML is hierarchical and contains only the <node> tag, which can be self-closing or not with the attributes within the tag.
What is the best way to accomplish this?
Performance here is quite important too, as this XML can contain over 100,000 nodes.
Should it be done with an xpath expression, with a regex, with the iXML parser, an XSLT call transformation?
Any help is greatly appreciated!
Best regards,
Vincent
‎2012 Jul 11 11:40 AM
Hi,
did you manage to get this to work?
I have the same thing here that I have to do.
thanks,
Caroline,
‎2012 Jul 13 2:13 PM
Use this FM to get into internal table
CALL FUNCTION 'ECATT_CONV_XSTRING_TO_STRING'
EXPORTING
im_xstring = zl_attcntx
IMPORTING
ex_string = zl_attcont.
SPLIT zl_attcont AT cl_abap_char_utilities=>newline INTO TABLE zit_legacy.