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

XML generation

Former Member
0 Likes
334

Hi Friends,

I Want to generate a XML file with same element 6 times but with different attributes. Kindly help me ASAP.

Reference code:

Created a parent node---vehicle_techdata.

want 6 child nodes under it with same name but different attribute value.

+ <vehicle_techdata/>

+ < modification modi_num = 1 />

+ < modification modi_num = 2 />

.........so on

Do 6 times.

wf_count = wf_count + 1.

w_parent = m_document->find_from_name(

name = 'vehicle_techdata' ).

*-- Add a sub-node 'Modification'

w_element = m_document->create_element( name = 'modification'

).

*-- Set a attribute for Varaint node

w_node = w_element->set_attribute( name = 'modi_num'

value = wf_count ).

w_node = w_parent->append_child( new_child = w_element ).

Enddo.

but here i get output as :

+ <vehicle_techdata/>

+ < modification modi_num = 1 />

< modification modi_num = 2 />

< modification modi_num = 2 />

.........so on

1 ACCEPTED SOLUTION
Read only

athavanraja
Active Contributor
0 Likes
302

Do 6 times.

wf_count = wf_count + 1.

w_parent = m_document->find_from_name(

name = 'vehicle_techdata' ).

*-- Add a sub-node 'Modification'

<b>clear w_element .</b>

w_element = m_document->create_element( name = 'modification'

).

*-- Set a attribute for Varaint node

<b>clear w_node .</b>

w_node = w_element->set_attribute( name = 'modi_num'

value = wf_count ).

w_node = w_parent->append_child( new_child = w_element ).

Enddo.

add these clear statements.

1 REPLY 1
Read only

athavanraja
Active Contributor
0 Likes
303

Do 6 times.

wf_count = wf_count + 1.

w_parent = m_document->find_from_name(

name = 'vehicle_techdata' ).

*-- Add a sub-node 'Modification'

<b>clear w_element .</b>

w_element = m_document->create_element( name = 'modification'

).

*-- Set a attribute for Varaint node

<b>clear w_node .</b>

w_node = w_element->set_attribute( name = 'modi_num'

value = wf_count ).

w_node = w_parent->append_child( new_child = w_element ).

Enddo.

add these clear statements.