cancel
Showing results for 
Search instead for 
Did you mean: 

DOM Programming in class for ABAP Mapping?

Former Member
0 Kudos

Hi All!!

I am struggling in transforming XML to be mapping target structures in using ABAP Mapping.

so i am on developing class with DOM.

i would like to know how many <person> derived from source xml, so what method should i use so that i can get that result. or does anyone idea how to work with multirecord to output XML?

data: incode1 type ref to if_ixml_node_collection,

incode2 type ref to if_ixml_node_collection,

  • get message content of tag <FirstName>

incode1 = idocument->get_elements_by_tag_name( 'FirstName' ).

incode2 = idocument->get_elements_by_tag_name( 'LastName' ).

<?xml version="1.0" encoding="UTF-8"?>

*Source XML

<ns:Personalinfo xmlns:ns="http://sap.com/test/ABAPMapping">

<person>

<FirstName>ABAP</FirstName>

<LastName>ITEM1</LastName>

</person>

<person>

<FirstName>ABAP</FirstName>

<LastName>ITEM2</LastName>

</person>

</ns:Personalinfo>

Message was edited by: Tony

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Tony,

You need to use the method get_length. Try something like: -

*Get the list of child nodes

child_nodes = idocument->get_children( ).

*Get the number of children within child_nodes.

int = child_nodes->get_length( ).

Thanks

Martin

Answers (0)