Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

write to a xml file


1 reply to this topic

forad4

forad4
  • Members
  • 2 posts

Posted 16 December 2005 - 23:04

hi all,

I need to update an existing xml file based on the value selected while installing my application. I can only append to the file and what I need is to add a line before the end of the close tag of the xml file.
<?xml version="1.0"?>
<ini>
<tag1> values</tag>
</ini>

I want to add a line <targetdir>new value </targetdir> before </ini>. so at the end the file should look like,
<?xml version="1.0"?>
<ini>
<tag1> values</tag>
<targetdir>new value </targetdir>
</ini>


Is this possible? please email to forad4@yahoo.com. thanks for the help.

Taco Bell

Taco Bell

    IS6 Expert

  • Moderators
  • 1,281 posts

Posted 17 December 2005 - 03:53

Well if you can truly only append to the file, then that's not ever gonna be possible, so I doubt you literally mean that. Simply that you have to keep the existing structure intact

That being said, there's nothing special about it being an XML file as the content is still plain text and InstallShield doesn't have functions specifically designed with that syntax in mind.

Therefore, you can just use the standard OpenFile, GetLine, and WriteLine functions to go through it line-by-line. Then conditionalize it to react accordingly when it's time to write out that TargetDir value.
user posted image