‎2007 May 22 9:10 AM
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
‎2007 May 22 9:19 AM
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.
‎2007 May 22 9:19 AM
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.