Re: reading XML string and writing it to a SQL database



Larry wrote:

This is not a cross-post. I asked a similar question in another
group but got no meaningful response. I am working with the output
of a digital scale. I retrieve the data from the scale via telnet as
a text string. The data is formatted with XML tags to denote the
data attributes and delimit each record. Mutiple records are
normally in a single stream. The records are very simple consisting
of only 6 or 8 fields.

Neither I nor the embedded programmer are very verse in XML which
accounts for why I am asking for assistance. The structure of the
string lies below.

<?xml version="1.0" standalone="yes" ?>
<DATAPACKET Version="2.0">
<METADATA>
<FIELDS>
<FIELD attrname="TXID" fieldtype="i2" />
<FIELD attrname="GroupID" fieldtype="i2" />
<FIELD attrname="ScaleID" fieldtype="i2" />
<FIELD attrname="Line" fieldtype="i2" />
<FIELD attrname="Station" fieldtype="i2" />
<FIELD attrname="Weight" fieldtype="fixed" DECIMALS="15"
WIDTH="18" /> <FIELD attrname="DateWeighed"
fieldtype="dateTime" /> </FIELDS>
<PARAMS />
</METADATA>
<ROWDATA />
</DATAPACKET>

This appears to be a TClientDataSet that includes 7 fields and 0
records. Try loading it into a TClientDataSet and see what you get.

HTH, Glynn


--
History records the names of royal bastards, but cannot tell us the
origin of wheat. (Jean Henri Fabre)
.


Quantcast