jasonkrueger
asked on
Insert contents of a TStringList into another TStringList at a specified index
I've got a situation where I'm creating an XML file for a client.
Currently I've been building the XML inside a TStringList and then saving it to a file using data obtained from a database. This worked fine, but now the client is wanting to 'embed' other XML schemas inside of the main XML schema.
Is it possible to create the main XML in a TStringList and place something like <InsertEmbeddedXMLHere> at the spot where the embedded XML will go and then insert the contents of another TStringList at that position?
Small Example:
TString1 TString2
---------- ----------
<XML> <Embedded>
<Tag 1></Tag1> <EmTag1></EmTag1>
<Tag2></Tag2> <EmTag2></EmTag2>
<InsertXMLHere> </Embedded>
<Tag3></Tag3>
</XML>
What I want for results is this:
TString1
----------
<XML>
<Tag 1></Tag1>
<Tag2></Tag2>
<Embedded>
<EmTag1></EmTag1>
<EmTag2></EmTag2>
</Embedded>
<Tag3></Tag3>
</XML>
Thank you to all that spend time helping with this. I appreciate it.
Jason
Currently I've been building the XML inside a TStringList and then saving it to a file using data obtained from a database. This worked fine, but now the client is wanting to 'embed' other XML schemas inside of the main XML schema.
Is it possible to create the main XML in a TStringList and place something like <InsertEmbeddedXMLHere> at the spot where the embedded XML will go and then insert the contents of another TStringList at that position?
Small Example:
TString1 TString2
---------- ----------
<XML> <Embedded>
<Tag 1></Tag1> <EmTag1></EmTag1>
<Tag2></Tag2> <EmTag2></EmTag2>
<InsertXMLHere> </Embedded>
<Tag3></Tag3>
</XML>
What I want for results is this:
TString1
----------
<XML>
<Tag 1></Tag1>
<Tag2></Tag2>
<Embedded>
<EmTag1></EmTag1>
<EmTag2></EmTag2>
</Embedded>
<Tag3></Tag3>
</XML>
Thank you to all that spend time helping with this. I appreciate it.
Jason
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
That's what I was looking for. Thank you!
Open in new window