cancel
Showing results for 
Search instead for 
Did you mean: 

Abap Mapping: XML iterative parsing.

Former Member
0 Kudos

Hi All,

I am trying to parse an XML file which structure is the following.

<Order>

<BookingCode>AAAAA</BookingCode>

<F1>

...

<F1>

<F2>

....

<F2>

<BookingCode>BBBBBB</BookingCode>

<F1>

...

<F1>

<F2>

....

<F2>

</Order>

More exactly I try to check all values of tag name "BookingCode" up to the end of the XML file. The number of occurrences of "BookingCode" is not determinated.

Is it necessary a loop after collecting a list of occurrences of "BookingCode"?

I am trying to use:

data: node_iterator type ref to if_ixml_node_iterator.

node_iterator = incode->CREATE_ITERATOR( ).

data: emp_node type ref to if_ixml_node.

emp_node = node_iterator->GET_NEXT( ).

data: emp_node_list type ref to if_ixml_node_list.

emp_node_list = emp_node->GET_CHILDREN( ).

data: emp_node_list_lenth type I.

emp_node_list_lenth = emp_node_list->GET_LENGTH( ).

Using the debugging I can not find exactly the behaviour.

Any suggestion for solving my issue will be well appreciated.

Thanks in advance.

Regards,

Giovanni

Accepted Solutions (1)

Accepted Solutions (1)

former_member190389
Active Contributor
0 Kudos

Hi,

Instead you can also loop at index

incode->get_item( index = x ).

data: outcode type ref to if_ixml_node.

outcode = incode->get_item( index = x ).

Edited by: Progirl Progirl on Mar 23, 2009 9:12 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

referring to a document in the net, I am trying to define the loop for understanding the behaviour but I receive the abend:

document: Understanding and working with ABAP Mapping (Steps to be followed in ABAP Mapping classes )

data: emp_node_list_iterator type ref to if_ixml_node_iterator.

data: emp_subnode type ref to if_ixml_node.

DO emp_node_list_lenth TIMES.

emp_subnode = emp_node_list_iterator->get_next( ).

....

Abend:

Runtime Errors OBJECTS_OBJREF_NOT_ASSIGNED_NO

Except. CX_SY_REF_IS_INITIAL

Thanks in advance for your kind support.

Regards,

Giovanni