Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

iXML - Checking if a specific node exists in XML data

Former Member
0 Likes
741

Hi,

I´m reading XML data by using iXML classes. One XML file I´m reading contains header and

item data.

Right now I´m starting with reading the header attributes and then read all nested nodes and their attribute data. That works all fine, but now I had the error, that the XML file wrongly didn´t contain the items.

My XML reading method then ended up in a dump because the node was null:

l_node = l_iterator->get_next( ).

Can anybody give me an advice, how to check at the beginning of reading my xml data, if a specific node (in my case the node for items) exists in the XML data? If not, I want to stop with an error message. I want to check that at the beginning, before reading all element data, to keep my method structured.

Thank you very much!

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
489

Hi,

You can create a filter and set that filter to the iterator. If this is done the iterator returns you only the node with a specific node name or node ID.

You can also check the parsing in the following WIKI code gallery

https://wiki.sdn.sap.com/wiki/x/JoDmAQ

Subroutines create_set_filter_attribute and parse_xml_file would be helpful.

1 REPLY 1
Read only

Former Member
0 Likes
490

Hi,

You can create a filter and set that filter to the iterator. If this is done the iterator returns you only the node with a specific node name or node ID.

You can also check the parsing in the following WIKI code gallery

https://wiki.sdn.sap.com/wiki/x/JoDmAQ

Subroutines create_set_filter_attribute and parse_xml_file would be helpful.