Skip to Content
0
Former Member
Jul 23, 2007 at 11:44 AM

xml file parse event base

36 Views

hello all,

i am learning xml file with sap help sample. I have a FM, that change xml-file into if_ixml_parser, but when i wrote the xml " <person status="retired">Walt Whitman</person>" and debug it.

event_sub was 312, <b>event was always initial</b>.

data: event type ref to if_ixml_event,

event_sub type i.

  • let the parser know which events I am interested in

event_sub = if_ixml_event=>co_event_element_pre2 +

if_ixml_event=>co_event_element_post.

parser->set_event_subscription( events = event_sub ).

do.

event = parser->parse_event( ).

if event is initial.

exit. ' either end reached or error (check below)

endif.

data: str type string.

case event->get_type( ).

when if_ixml_event~co_event_element_pre2.

str = event->get_name( ).

write: '<' str '>'.

when if_ixml_event~co_event_text_post.

str = event->get_value( ).

write: str.

endcase.

enddo.

Thanks for Request.

sap" target="_blank">http://help.sap.com/saphelp_nwmobile71/helpdata/de/47/b5413acdb62f70e10000000a114084/frameset.htm">sap library - Parsing an XML document event-based

Best regards

Shuo