none
How do I embed XML Data into MS Outlook email RRS feed

  • Question

  • Hello,

    I am sending MS outlook 2010 emails from my application. In the email if I put xml, it just displays the element values. It is considering xml tags as HTML tags and processing it. I just want to display xml.

    Any help will be appreciated.

    -MJS

    Thursday, October 11, 2012 2:38 AM

Answers

  • Escape the XML so it's treated as text. For example "<" would be "&lt;".
     
    The following escapes need to be made in the correct order such as the following c# procedure:
     

    internal static string XMLEscape(string inputXML)

    {

        string outXML = "";

        try

        {

            string ampersand = inputXML.Replace("&", "&amp;"); // this replacement         must be first

            string lessThan = ampersand.Replace("<", "&lt;");

            string greaterThan = lessThan.Replace(">", "&gt;");

            string backslash = greaterThan.Replace(@"\""", "&quot;");

            string quote = backslash.Replace(@"""", "&quot;");

            outXML = quote.Replace("'", "&apos;");

        }

        catch (Exception ex)

        {

                outXML = "";

        }

        return outXML;

    }


    --
    Ken Slovak
    [MVP-Outlook]
    http://www.slovaktech.com
    Author: Professional Programming Outlook 2007
    "MJS85" <=?utf-8?B?TUpTODU=?=> wrote in message news:e9061aa0-e1ec-4ad6-a582-781ae91f1f57...

    Hello,

    I am sending MS outlook 2010 emails from my application. In the email if I put xml, it just displays the element values. It is considering xml tags as HTML tags and processing it. I just want to display xml.

    Any help will be appreciated.

    -MJS


    Ken Slovak MVP - Outlook
    Thursday, October 11, 2012 2:27 PM
    Moderator