如何把一个record类型的数据,生成xml
首先声明,record 里面的字段名和字段个数不固定,
如:
Rec1 = record
a1:array[0..07] of Char;
a2:array[0..02] of Char;
end;
Rec2 = record
a3:array[0..07] of Char;
a4:array[0..02] of Char;
a5:array[0..1] of char;
end;
现在要实现这样一个函数:
test(rec:record)
生成相应的xml
<?xml version="1.0" encoding="GB2312"?>
<Root>
<Body>
<rec1>
<Rec>
<a1 Value="GSP"/>
<a2 Value="ZZ"/>
</Rec>
</rec1>
</Body>
</Root>
<?xml version="1.0" encoding="GB2312"?>
<Root>
<Body>
<rec2>
<Rec>
<a3 Value="GSP"/>
<a4 Value="ZZ"/>
<a5 Value="hello"/>
</Rec>
</rec2>
</Body>
</Root>