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



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
No this is no help.

I updated my post to include data. I generated the data packet using a CDS
and loaded it from a table. How do I get data from a string as below into a
database. That is the question.



"Glynn Owen" <me@xxxxxxxx> wrote in message
news:44a1df9c@xxxxxxxxxxxxxxxxxxxxxxxxx
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" encoding="UTF-8" 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="LineID" fieldtype="i2" />
<FIELD attrname="StationID" fieldtype="i2" />
<FIELD attrname="Weight" fieldtype="fixed" DECIMALS="15"
WIDTH="18" />
<FIELD attrname="DateWeighed" fieldtype="dateTime" />
</FIELDS>
<PARAMS />
</METADATA>
<ROWDATA>
<ROW TXID="3" GroupID="10" ScaleID="1" LineID="1" StationID="1"
Weight="23.344600000000000"
DateWeighed="20060627T16:19:00000" />
<ROW TXID="3" GroupID="7" ScaleID="1" LineID="1" StationID="7"
Weight="23.581200000000000" DateWeighed="20060627T16:24:00000" />
<ROW TXID="3" GroupID="7" ScaleID="1" LineID="1" StationID="7"
Weight="24.581200000000000" DateWeighed="20060627T16:25:18150" />
<ROW TXID="4" GroupID="7" ScaleID="1" LineID="1" StationID="7"
Weight="24.580200000000000" DateWeighed="20060627T16:25:30350" />
</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