Skip to Content
author's profile photo Former Member
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 a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • author's profile photo Former Member
    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 a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.