using System.Collections.Generic;
using System.Xml.Serialization;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO.Compression;
public static void Test()
var requestObj = GetXml();
var xmlDoc = XDocument.Parse(requestObj);
XNamespace newNamespace = "http://schemas.something.org/bla/07/WebServices.Stuff";
foreach (var e in xmlDoc.Descendants().Where(a => a.Name.LocalName == "Addresses").SelectMany(a => a.DescendantsAndSelf()))
e.Name = newNamespace + e.Name.LocalName;
xmlDoc.Root.SetAttributeValue(XNamespace.Xmlns + "b", newNamespace.NamespaceName);
Console.WriteLine(xmlDoc);
var xml = @"<root><SubElement>
<AddressLine1>RZN850PXKYG</AddressLine1>
<AddressLine2>RYK57IT7Y9Z</AddressLine2>
<AddressType>Physical</AddressType>
<PostalCode>9999</PostalCode>
<Province>Some Province</Province>
<Suburb>Some Suburb</Suburb>
public static void Main()
Console.WriteLine("Roslyn Compiler; Environment version: " + Environment.Version);
Console.WriteLine("Uncaught exception: ");