Application Development 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: 

insert_child with same name

Former Member
0 Kudos

Hello XML-on-Abaps

Keywords: if_ixml, XML, node

Could somebody please explain, how to insert more than one children with the same name to a node.

When I'm iterating through a collection (node_collection), I collect some insert points for my new children nodes.

As I read the documentation, that's not possible with append_child. This command overwrites an existing node if there's any.

So I use node->insert_child( ).

-to insert: node outcode

-position of other node on same level

call method getnode->insert_child

exporting

new_child = outcode

ref_child = nodelastchild

receiving

rval = l_result.

if l_result <> 0.

raise xml_conversion_failed.

endif.

or graphically I want that:

..

<Node>

<Person> Node with subnode

<Person> Node with subnode

<Node>

..

what should I use? another method? or is that not possible?

cheers & thanks,

Markus

1 REPLY 1

Former Member
0 Kudos

Some times later I found my solution:

*clonenode nodelastchild is last child

if nam eq 'Person'.

clonenode = nodelastchild->clone( depth = -1 ).

nam = clonenode->get_name( ).

getnode->insert_child( new_child = clonenode

ref_child = nodelastchild ).

endif.

cheers,

Markus