SSIS VB.NET Script Task Error ]]> is not allowed in character data

  • I have a requirement to write an Xml file from SSIS. I have chosed to use the script task and use the StreamReader class for writing the file. The XML must use CDATA sections, however I cannot seem to include the characters ]]> in the string variable that I use to build my XML. I have broken the problem down into the following example:

    Dim sXml As String = ""

    sXml = "]]>"

    MsgBox(sXml)

    Dts.TaskResult = ScriptResults.Success

    This will not compile and gives the error "]]> is not allowed in character data."

    The error is occurring for me in both 2005 & 2008, however I need to deploy this in 2005.

    Any help/explanation would be much appreciated.

  • richardn (5/1/2009)


    I have a requirement to write an Xml file from SSIS. I have chosed to use the script task and use the StreamReader class for writing the file. The XML must use CDATA sections, however I cannot seem to include the characters ]]> in the string variable that I use to build my XML. I have broken the problem down into the following example:

    Dim sXml As String = ""

    sXml = "]]>"

    MsgBox(sXml)

    Dts.TaskResult = ScriptResults.Success

    This will not compile and gives the error "]]> is not allowed in character data."

    The error is occurring for me in both 2005 & 2008, however I need to deploy this in 2005.

    Any help/explanation would be much appreciated.

    You cannot use this combination because the script code is itself contained as part of the package XML file as CDATA section. Try this to avoid the issue:

    Dim sXml As String = ""

    sXml = "]]" & Chr(62)

    MsgBox(sXml)

    Dts.TaskResult = ScriptResults.Success

    ---
    SSIS Tasks Components Scripts Services | http://www.cozyroc.com/

  • Works a treat.

    Thanks!:-)

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply