0

I am trying to replace existing value of some attribute in .xml file. The line that is to be written is ${VAULT::ab::a-b::1} When I try to write it using xmldom or existing string replacement functions in InstallScript, I see that the file gets updated with above string but curly bracket at the end (}) goes to another line. This is happening at 2 instances in XML file. I have no idea why this happens. I think curly braces don't need an escape though.

Ronan Boiteau
  • 9,608
  • 6
  • 34
  • 56
SGee
  • 11
  • 5
  • I don't see anything obviously wacky about that string value. Perhaps you could share sample excerpts of your code in case the cause is specific to how you're doing it? – Michael Urman Nov 26 '17 at 19:20
  • Thanks Michael. Using string Replacement methods in installscript i am using code : nResult=FileInsertLine (szFileName, szReturnLine, nLineNo, REPLACE); Using XMLDOM i am using set oXMLConnAttriNode=oXMLNodeList.item(nIndex).selectSingleNode("security/password"); oXMLConnAttriNode.text="${"+szDB_Password+"}"; where szDB_Password is property that is being read from an existing file. I see value correctly deduced for property in the msi logs. Both these tend to put } to next line of ::1 in variable above in question – SGee Nov 27 '17 at 07:43
  • And after updation string in .xml shows as: . Notice there is space after 1 and } , and in XML it is into 2 different lines – SGee Nov 27 '17 at 08:19

1 Answers1

0

Based on the additional information in your comments, I believe your variable szDB_Password contains a newline or a carriage return and linefeed.

You could figure out how those charcters are getting into your variable and address that, or you could remove them later. To remove them, either resize the string; use StrSub to exclude the last character or two; or use StrReplace twice to replace "\r" and "\n" each with "".

Michael Urman
  • 15,737
  • 2
  • 28
  • 44
  • Yea, I could see a new line at the end of .txt file where i was reading up and storing up property from. May be wildfly commands were writing o/p the way including new line at end. Thanks for pointing it out and your valuable inputs, Michael. – SGee Nov 29 '17 at 13:00