Application Development 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: 

method get_attribute_node from interface IF_IXML_ELEMENT

Former Member
0 Kudos

hi all

i want to use the method get_attribute_node from interface IF_IXML_ELEMENT for working with xml.

the xml has an id, let's here


<printObject ID="1" type="numberField">

the import parameters from get_attribute_node are name and namespace. The Name it's clear, but Namespace what's mean it, the value from an attribute, example 1 by ID?

Thx

abap_begin

1 ACCEPTED SOLUTION

Former Member
0 Kudos

You don't have a namespace in the XML fragment. A namespace by example is : <msx:printline msx:id = '01'>Town</msx:printline>

This is an example for obtaining data from atrribute:

DATA : l_next_col2 TYPE REF TO if_ixml_element,

l_attr_value TYPE string.

l_attr_value = l_next_col2->get_attribute( name = 'id' ).

2 REPLIES 2

Former Member
0 Kudos

You don't have a namespace in the XML fragment. A namespace by example is : <msx:printline msx:id = '01'>Town</msx:printline>

This is an example for obtaining data from atrribute:

DATA : l_next_col2 TYPE REF TO if_ixml_element,

l_attr_value TYPE string.

l_attr_value = l_next_col2->get_attribute( name = 'id' ).

Former Member
0 Kudos

sorry, i forgot something..in fact, i want to read the node with attribute 'id' and value '1' into object IF_IXML_NODE.

for example....

<printObjects>
	<printObject ID="1" type="numberField">
		<source>event</source>
		<type>fixedValue</type>
		<factor>1.00000</factor>
		<format>0,001</format>
		<generalParams>
			<xPos>270</xPos>
			<yPos>427</yPos>
			<font name="MTBDLFRO" size="10" region="W-EUROPE"/>
			<align>left</align>
			<rotation>0</rotation>
			<parentID>-2</parentID>
			<externPO load="No" name="" pluGroup=""/>
		</generalParams>
	</printObject>
	<printObject ID="2" type="unitChar">
		<type>weight</type>
		<countryCode>CH</countryCode>
		<generalParams>
			<xPos>96</xPos>
			<yPos>-1</yPos>
			<font name="ARIAL" size="10" region="W-EUROPE"/>
			<align>left</align>
			<rotation>0</rotation>
			<parentID>1</parentID>
			<externPO load="No" name="" pluGroup=""/>
		</generalParams>
	</printObject>
<printObjects>

how i can do that?

thx abap_begin

Edited by: abap_begin on Feb 2, 2010 11:39 AM