public static void Main()
var xdoc = XDocument.Parse(@"<?xml version=""1.0"" encoding=""utf-16""?>
<Engineering version=""V17"" />
<Interface><Sections></Sections></Interface>
<MemoryLayout>Optimized</MemoryLayout>
<MemoryReserve>100</MemoryReserve>
<Name>EM00_CM01_Warp1</Name>
<ProgrammingLanguage>LAD</ProgrammingLanguage>
<SetENOAutomatically>false</SetENOAutomatically>
<SW.Blocks.CompileUnit ID=""4"" CompositionName=""CompileUnits"">
<FlgNet xmlns=""http://www.siemens.com/automation/Openness/SW/NetworkSource/FlgNet/v4"">
<Access Scope=""GlobalVariable"" UId=""27"">
<Component Name=""HMIAxisCtrl_Interface"" />
<Component Name=""axesInterface"" AccessModifier=""Array"">
<Access Scope=""LiteralConstant"">
<ConstantType>DInt</ConstantType>
<ConstantValue>0</ConstantValue>
var nm = new XmlNamespaceManager(new NameTable());
nm.AddNamespace("sm", "http://www.siemens.com/automation/Openness/SW/NetworkSource/FlgNet/v4");
var node = xdoc.XPathSelectElement(@"//sm:Access[@Scope=""LiteralConstant""]/sm:Constant/sm:ConstantValue", nm);
node.Value = "Something Else";
Console.WriteLine(xdoc.ToString());