Skip to Content
author's profile photo
Former Member

insert_child with same name

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

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

1 Answer

  • author's profile photo
    Former Member
    Posted on Dec 17, 2004 at 10:31 AM

    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

    Add comment
    10|10000 characters needed characters exceeded