Delphi Pages Forums

Delphi Pages Forums (http://www.delphipages.com/forum/index.php)
-   General (http://www.delphipages.com/forum/forumdisplay.php?f=2)
-   -   [SOLVED] String Parsing of XML document (http://www.delphipages.com/forum/showthread.php?t=218685)

FreakaZoid2 08-23-2019 03:08 PM

String Parsing of XML document
 
I have about 200,000 plus XML documents to parse that contain client details. so data is not repeating nodes. same node structure from file to file. I have it working with the xmldocument interface/parsing but it is taking a long time to read/parse those files and am wanting to rewrite using stringlist/string to parse the data. but I am writing a bunch of if position, copy(…) type of commands and figured someone has got to have a better idea of how to parse these xml files
<CLIENTINFO>
<APPS>
<APPSD LastUpdateUser="NA" LastUpdateTime="00000000" LastUpdateDate="00000000" Release="r" Patch="ppp" Version="VVVVV" Licensed="false" Application="AA" />
<APPSD LastUpdateUser="uuu" LastUpdateTime="11000615" LastUpdateDate="20171201" Release="rr" Patch="ppp" Version="vvvvv" Licensed="true" Application="AB" />
<APPSD LastUpdateUser="NA" LastUpdateTime="00000000" LastUpdateDate="00000000" Release="rrr" Patch="ppp" Version="vvvvv" Licensed="false" Application="AC" />
</APPS>
<APPSINFO>
<AA>
<AA_RECORDS>
<AA_RECORD UseDMS="false" NotificationEMail="" NotificationLevel="None" AllowEMail="false" ImageType="iiiii" />
<AA_RECORD UseDMS="false" NotificationEMail="" NotificationLevel="None" AllowEMail="false" ImageType="iiiii" />
</AA_RECORDS>
</AA>
<AB>
<AB_SYSTEM title=tttttt Interface="none" Footer4="" Footer3="" Footer2="" Footer1="" Phone="111-222-3333" Zip="99999" State="ss" City="cccccc" Address2="" Address1="101 Main" Number="9999999" />
<AB_APPS>
<AB_AA Auto="false" Used="true" />
<AB_AB Auto="false" Used="true" />
</AB_APPS>
<AB_METHODS>
<AB_METHOD AB_Type="NA" Type="tttt" Description="ddddddd" Code="c1" />
<AB_METHOD AB_Type="Online" Type="ttttt" Description="dddddddd" Code="c2" />
</AB_METHODS>
<AB_CODES>
<AB_CODE Description="dddddd" Code="abab" Account="aaaaa" />
</AB_CODES>
</AB>
</APPSINFO>

FreakaZoid2 08-23-2019 03:12 PM

HTML Code:

<ClientInfo>
  <CityID>CCCCCCCCCCCCCCCCCC</CityID>
  <CityName>NNNNNNNNNNNNNNN</CityName>
  <UserName>uuuuuuuu</UserName>
  <DateTime>2017-12-01 11:00:45</DateTime>
  <OpSystem>WIN/NT</OpSystem>
  <Apps>
    <AppsD Application="AA" Licensed="false" Version="VVVVV" Patch="ppp" Release="r" LastUpdateDate="00000000" LastUpdateTime="00000000" LastUpdateUser="NA" />
    <AppsD Application="AB" Licensed="true" Version="vvvvv" Patch="ppp" Release="rr" LastUpdateDate="20171201" LastUpdateTime="11000615" LastUpdateUser="uuu" />
    <AppsD Application="AC" Licensed="false" Version="vvvvv" Patch="ppp" Release="rrr" LastUpdateDate="00000000" LastUpdateTime="00000000" LastUpdateUser="NA" />
  </Apps>
  <AppsInfo>
    <AA>
      <AA_Records>
        <AA_Record ImageType="iiiii" AllowEMail="false" NotificationLevel="None" NotificationEMail="" UseDMS="false" />
        <AA_Record ImageType="iiiii" AllowEMail="false" NotificationLevel="None" NotificationEMail="" UseDMS="false" />
      </AA_Records>
    </AA>
    <AB>
      <AB_System Number="9999999" Title="tttttt" Address1="101 Main" Address2="" City="cccccc" State="ss" Zip="99999" Phone="111-222-3333" Footer1="" Footer2="" Footer3="" Footer4="" Interface="none" />
      <AB_Apps>
        <AB_aa Used="true" Auto="false" />
        <AB_ab Used="true" Auto="false" />
      </AB_Apps>
      <AB_Methods>
        <AB_Method Code="c1" Description="ddddddd" Type="tttt" AB_Type="NA" />
        <AB_Method Code="c2" Description="dddddddd" Type="ttttt" AB_Type="Online" />
      </AB_Methods>
      <AB_Codes>
        <AB_Code Code="abab" Description="dddddd" Account="aaaaa" />
      </AB_Codes>
    </AB>
  </AppsInfo>
</ClientInfo>


rojam 08-23-2019 06:14 PM

Have you tried using TClientDataSet? I believe it can read and write to an XML file and you get the benefit of being able to hit the data as a table.
Check out: http://docs.embarcadero.com/products...dFromFile.html

You'll probably need to prep the data by using TXMLTransform.

FreakaZoid2 08-23-2019 09:37 PM

my stupidity
 
the xml parsing is plenty fast, its the select, (insert/update) that is taking so long. I will see about testing/implement clientdatasets.


Thanks everyone.


All times are GMT. The time now is 12:05 PM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2019, vBulletin Solutions, Inc.