zoukankan      html  css  js  c++  java
  • delphi TClientDataSet 保存到XML

    procedure ExPortNodeQuantifyComponent1(aCDS: TClientDataSet; aCurrNode: TXMLNode);
    var
    mStream: TMemoryStream;
    I: Integer;
    vNode: TcxTreeListNode;
    NativeXml: TNativeXml;
    vXMLNode, rootNode: TXmlNode;
    begin
    mStream:=TMemoryStream.Create;
    NativeXml := TNativeXml.CreateName('aaa');
    try
    NativeXml.EncodingString := 'UTF-8';
    NativeXml.Utf8Convert := True;
    NativeXml.XmlFormat := xfReadable;
    NativeXml.BinaryEncoding := xbeBinHex;
    // rootNode := NativeXml.Root;
    for I := 0 to SGrid_QuantifyList.Count -1 do
    begin
    vNode := SGrid_QuantifyList.Items[I];
    aCDS.Append;
    aCDS.FieldByName('cSetOfPeakTime').AsString := vNode.Texts[colcom_cSetOfPeakTime.ItemIndex];
    aCDS.FieldByName('cComponentName').AsString := vNode.Texts[colcom_cComponentName.ItemIndex];
    aCDS.FieldByName('cComponentNumber').AsString := vNode.Texts[colcom_cComponentNumber.ItemIndex];
    aCDS.FieldByName('cCorrectionFactor').AsString := vNode.Texts[colcom_cCorrectionFactor.ItemIndex];
    aCDS.FieldByName('cConcentration').AsString := vNode.Texts[colcom_cConcentration.ItemIndex];
    aCDS.FieldByName('cInteriorLabel').AsString := vNode.Texts[colcom_cInteriorLabel.ItemIndex];
    aCDS.FieldByName('cPeakStart').AsString := vNode.Texts[colcom_cPeakStart.ItemIndex];
    aCDS.FieldByName('cPeakEnd').AsString := vNode.Texts[colcom_cPeakEnd.ItemIndex];
    aCDS.FieldByName('cGroupTotal').AsString := vNode.Texts[colcom_cGroupTotal.ItemIndex];
    aCDS.FieldByName('iid').AsString := vNode.Texts[colcom_iid.ItemIndex];
    aCDS.FieldByName('cGroupID').AsString := vNode.Texts[colcom_cGroupID.ItemIndex];
    aCDS.FieldByName('cTheSameBatchID').AsString := vNode.Texts[colcom_cTheSameBatchID.ItemIndex];

    aCDS.Post;
    vXMLNode := aCurrNode.NodeNew('aaa' + IntToStr(I)) ;
    vXMLNode.WriteAttributeString('cSetOfPeakTime', vNode.Texts[colcom_cSetOfPeakTime.ItemIndex]);
    vXMLNode.WriteAttributeString('cComponentName', vNode.Texts[colcom_cComponentName.ItemIndex]);
    vXMLNode.WriteAttributeString('cComponentNumber', vNode.Texts[colcom_cComponentNumber.ItemIndex]);
    vXMLNode.WriteAttributeString('cCorrectionFactor', vNode.Texts[colcom_cCorrectionFactor.ItemIndex]);
    vXMLNode.WriteAttributeString('cConcentration', vNode.Texts[colcom_cConcentration.ItemIndex]);
    vXMLNode.WriteAttributeString('cInteriorLabel', vNode.Texts[colcom_cInteriorLabel.ItemIndex]);
    vXMLNode.WriteAttributeString('cPeakStart', vNode.Texts[colcom_cPeakStart.ItemIndex]);
    vXMLNode.WriteAttributeString('cPeakEnd', vNode.Texts[colcom_cPeakEnd.ItemIndex]);
    vXMLNode.WriteAttributeString('cGroupTotal', vNode.Texts[colcom_cGroupTotal.ItemIndex]);
    vXMLNode.WriteAttributeString('iid', vNode.Texts[colcom_iid.ItemIndex]);
    vXMLNode.WriteAttributeString('cGroupID', vNode.Texts[colcom_cGroupID.ItemIndex]);
    vXMLNode.WriteAttributeString('cTheSameBatchID', vNode.Texts[colcom_cTheSameBatchID.ItemIndex]);
    end;
    NativeXml.SaveToFile('C:111.xml');
    aCDS.DisableControls;
    mStream.Clear;
    if not aCDS.IsEmpty then
    begin
    aCDS.SaveToStream(mStream);
    //XmlWriteStream(aCurrNode,CH_QuantifyComponentChildNode,mStream);
    end;
    aCDS.EnableControls;
    finally
    mStream.Free;
    NativeXml.Free;
    end;
    end;

  • 相关阅读:
    递延收益的主要账务处理
    少数股东权益
    一揽子交易中处置价款与净资产账面价值差额为什么计入其他综合收益
    为什么权益法下其他综合收益合并时要计入投资收益
    R语言代写实现MCMC中的Metropolis–Hastings算法与吉布斯采样
    加速R语言代码的策略
    R语言代写:EM算法和高斯混合模型的实现
    R语言代写进行网站评论文本数据挖掘聚类
    R语言代写对推特数据进行文本情感分析
    WEKA代写文本挖掘分析垃圾邮件分类模型
  • 原文地址:https://www.cnblogs.com/zhangzhifeng/p/5420311.html
Copyright © 2011-2022 走看看