Most examples on the Internet are incorrect.
The most important thing is to set the ROW label as a rowTag, for example:
<? Xml version = '1. 0'?>
<Root>
<Record>
<Column1> aaaa </column1>
<Column2> bbbb </column2>
</Record>
</Root>
Assume that your table is
Table aaa
(
Aaa varchar (20 ),
Bbb varchar (20)
)
Specify the tag to start recording.
Save. setRowTag ("record ");
Generally, the XML obtained from the original table uses a fixed rowsettag and rowtag. The name is
ROWSET and RWO
For example:
<? Xml version = '1. 0'?>
<ROWSET>
<ROW num = "1">
<Column1> aaaa </column1>
<Column2> bbbb </column2>
</ROW>
</ROWSET>
But before you get the string, specify the name you want:
Qry. setRowSetTag ("TABLENAME ");
Qry. setRowTag ("RECORDNAME ");
In this way, you will get
<? Xml version = '1. 0'?>
<TABLENAME>
<RECORDNAME num = "1">
<Column1> aaaa </column1>
<Column2> bbbb </column2>
</RECORDNAME>
</TABLENAME>
So you only need to specify the corresponding tag as ROWTAG when writing it in:
Save. setRowTag ("RECORDNAME ");
Save. insertXML (xml); OK.
In addition, note that XML is case sensitive. Your RECORDNAME and recordname are two different tags.