Click here to Skip to main content
15,884,836 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to Pass NonValidXmlCharacters in BizTalkServer?


Here I'm using scripting function to pass NonValidXmlCharacters

In scipting function I'm using inline c#:
below following code I have written but it is not sending some non valid characters

C#
public String stripNonValidXMLCharacters(String in)
 {
        StringBuilder out = new StringBuilder();
        char current;
        if (in == null || ("".equals(in))) return "";
        for (int i = 0; i < in.length(); i++)
 {
            current = in[i];
            if ((current == 0x9) ||
                (current == 0xA) ||
                (current == 0xD) ||
                ((current >= 0x20) && (current <= 0xD7FF)) ||
                ((current >= 0xE000) && (current <= 0xFFFD)) ||
                ((current >= 0x10000) && (current <= 0x10FFFF)))
                out.append(current);
        }
        return out.toString();
    }


Data I'm sending as input is: "dsdfjhdskjjdkldskjd",hdjgshsg#*jhj%@&"
Posted
Updated 30-Nov-10 7:57am
v3

1 solution

You could use this the System.Security.SecurityElement.Escape() method.

It will actually replace the characters with valid xml representations.

--- Oops. Nevermind, you're talking about biztalk...
 
Share this answer
 
v2

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900