Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Using XML-nodes in Transformation

orothred23
Discoverer
0 Likes
639

Hi,

I´m splitting up an XML-file into single nodes and want to put that nodes into different XML-transformations.

My current code is this:

" iXML-Object

DATA(lo_ixml) = cl_ixml_core=>create( ).

" XML-Document

DATA(lo_xmldoc) = lo_ixml->create_document( ).

" Stream-Factory

DATA(lo_xmlsf) = lo_ixml->create_stream_factory( ).

" Stream

DATA(lo_stream) = lo_xmlsf->create_istream_xstring( string = lv_xstring ).

" Parser-Object

DATA(lo_parser) = lo_ixml->create_parser( document = lo_xmldoc

istream = lo_stream

stream_factory = lo_xmlsf ).

 

IF lo_parser->parse( ) = 0.

"Root-Node

DATA(lo_root) = lo_xmldoc->get_root_element( ).

 

" Get all E1EDKA1-nodes

DATA(lo_nodes_e1edka1) = lo_root->get_elements_by_tag_name( name = 'E1EDKA1' ).

" Iterator for found nodes

DATA(lo_node_iterator) = lo_nodes_e1edka1->create_iterator( ).

" first iterator-value

DATA(lo_nodes_temp) = lo_node_iterator->get_next( ).

" Iterate

WHILE NOT lo_nodes_temp IS INITIAL.

" Get child nodes

DATA(lo_node_children) = lo_nodes_temp->get_children( ).

" Get iterator for child nodes

DATA(lo_child_iterator) = lo_node_children->create_iterator( ).

" Get first child

DATA(lo_child_node) = lo_child_iterator->get_next( ).

 

I now want to loop over that nodes and want to call transformations for every node. I saw that there is a render-function, but how can I use that function to create XML-itabs from the nodes to use them in the transformation?

Hi,

I´m splitting up an XML-file into single nodes and want to put that nodes into different XML-transformations.

My current code is this:

" iXML-Object

DATA(lo_ixml) = cl_ixml_core=>create( ).

" XML-Document

DATA(lo_xmldoc) = lo_ixml->create_document( ).

" Stream-Factory

DATA(lo_xmlsf) = lo_ixml->create_stream_factory( ).

" Stream

DATA(lo_stream) = lo_xmlsf->create_istream_xstring( string = lv_xstring ).

" Parser-Object

DATA(lo_parser) = lo_ixml->create_parser( document = lo_xmldoc

istream = lo_stream

stream_factory = lo_xmlsf ).

 

IF lo_parser->parse( ) = 0.

"Root-Node

DATA(lo_root) = lo_xmldoc->get_root_element( ).

 

" Get all E1EDKA1-nodes

DATA(lo_nodes_e1edka1) = lo_root->get_elements_by_tag_name( name = 'E1EDKA1' ).

" Iterator for found nodes

DATA(lo_node_iterator) = lo_nodes_e1edka1->create_iterator( ).

" first iterator-value

DATA(lo_nodes_temp) = lo_node_iterator->get_next( ).

" Iterate

WHILE NOT lo_nodes_temp IS INITIAL.

" Get child nodes

DATA(lo_node_children) = lo_nodes_temp->get_children( ).

" Get iterator for child nodes

DATA(lo_child_iterator) = lo_node_children->create_iterator( ).

" Get first child

DATA(lo_child_node) = lo_child_iterator->get_next( ).

 

I now want to loop over that nodes and want to call transformations for every node. I saw that there is a render-function, but how can I use that function to create XML-itabs from the nodes to use them in the transformation?

0 REPLIES 0