Question: I'm trying to figure out to to combine a serialized object with an existing xml doc and return it as a webservice.

Thanks ahead for you help.

Sample code:

```
[WebMethod]
    public string GetApple()
    {

    Apples apples = Report.GetReport();
    //  this returns:
        //  <Apples xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="http://tempuri.org/">
        //  <Name>Smtih</Name>
        //  <Size>11</Size>
        //  <Weight>111</Weight>
        //  <Color>Red</Color>
        //  </Apples>

    string TemplatePath = Server.MapPath("~/Template.xml");
        // this is:
        // <?xml version="1.0" encoding="utf-8" ?>
        // <applereport>
        //  <moretags>
        //    <july>
        //      <report>
        //        <DATA-GOES-HERE></DATA-GOES-HERE>
        //      </report>
        //    </july>
        //  </moretags>
        // </applereport>

        // Read TemplatePath into a memory stream
        // find the node: <DATA-GOES-HERE></DATA-GOES-HERE>
        // 
        // put serialixed output of Report.GetReport() where <DATA-GOES-HERE></DATA-GOES-HERE> is

        return FullReport;
}

```

Answer: 
In C and C++ strings are *usually* stored in memory as 8-bit char values where the value stored is the [ASCII](http://en.wikipedia.org/wiki/ASCII) value of the character.

Your code is therefore XORing the ASCII values. For example, the second character in your output is calculated as follows:

```

  'B' ^ ' '
= 66 ^ 32
= 01000010 ^ 00100000
= 01100010
= 98
= 'b'

```

You could get a different result if you ran this code on a system which uses [EBCDIC](http://en.wikipedia.org/wiki/Extended_Binary_Coded_Decimal_Interchange_Code) instead of ASCII.
> So does this mean the byte which makes up the character is being XORed?

Exactly.

> What does this look like?

As any other XOR :) . In ASCII "A nice cat" is (in hexadecimal)

```
41 20 6E 69 63 65 20 63 61 74

```

and ABCDEFGHIJ

```
41 42 43 44 45 46 47 48 49 4A

```

so, if you XOR each byte with each other, you get

```
00 62 2D 2D 26 23 67 2B 28 3E

```

, which is the hexadecimal representation of "\0b--&#g+(>", i.e. the string that is displayed when you run that code.

Notice that if you XOR again the resulting text you get back the text with which you started; this the reason why XOR is used often in encoding and cyphering.