2

I have a simple ssis package what saves result from web service method to XML file. Connection OK, file creating, but contains &lt; and &gt; tags instead of < and > .

How I can replace this tags to correct? enter image description here

Hadi
  • 36,233
  • 13
  • 65
  • 124
Key
  • 71
  • 1
  • 9

2 Answers2

1

The main issue is that you are passing the xml from the web service as a string (Not recommended)

you have to change the web method to return an XmlDocument, load the well-formed xml into it, and passed it back SSIS.

Or you can do a little workaround is to run a script after saving the xml file and replace &lt; with < and &gt; with >

Useful Links

Community
  • 1
  • 1
Hadi
  • 36,233
  • 13
  • 65
  • 124
  • Thank You Hadi, I interesting in this method: http://stackoverflow.com/questions/5006020/decode-xml-returned-by-a-webservice-and-are-replaced-with-lt-and-gt . Would be great if you can provide some example here. – Key Apr 08 '17 at 15:27
0

Also one of options

    Dim fileFirst As String = Dts.Variables("User::FullFilePath").Value.ToString()
    File.WriteAllText(fileFirst, File.ReadAllText(fileFirst).Replace("&lt;", "<"))

    Dim fileSecond As String = Dts.Variables("User::FullFilePath").Value.ToString()
    File.WriteAllText(fileSecond, File.ReadAllText(fileSecond).Replace("&gt;", ">"))

    Dim fileThird As String = Dts.Variables("User::FullFilePath").Value.ToString()
    File.WriteAllText(fileThird, File.ReadAllText(fileThird).Replace("&amp;", "&"))

    Dim fileFour As String = Dts.Variables("User::FullFilePath").Value.ToString()
    File.WriteAllText(fileFour, File.ReadAllText(fileFour).Replace("&quot;", "\"))

    Dim fileFive As String = Dts.Variables("User::FullFilePath").Value.ToString()
    File.WriteAllText(fileFive, File.ReadAllText(fileFive).Replace("&apos;", "'"))

using Script task -> VB

Key
  • 71
  • 1
  • 9