title: replace value of element in XML
body: <p>I need to replace value of <code>&lt;ResourceId&gt;</code> element. If I delete everything before 
  <code>&lt;VectorLayerDefinition&gt;</code> and after this element everything works fine, but I have a lot of these xml files and I can't delete anything from it manually. Any suggestions?</p>
  
  <p>Here the xml code:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"&gt;
    &lt;rdf:Description rdf:about="sdf:FeatureClass1"&gt;
      &lt;ns0:FeatureSource xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" rdf:resource="fsd://1" /&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="sdf:FeatureClass1"&gt;
      &lt;rdf:type rdf:resource="http://www.autodesk.com/gis/resource/definitions/LayerDefinitionResource" /&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="sdf:FeatureClass1"&gt;
      &lt;ns0:name xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" xml:lang="en" rdf:parseType="Literal"&gt;FeatureClass1&lt;/ns0:name&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="sdf:FeatureClass1"&gt;
      &lt;ns0:isURL xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" xml:lang="en" rdf:parseType="Literal"&gt;no&lt;/ns0:isURL&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="sdf:FeatureClass1"&gt;
      &lt;ns0:description xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" xml:lang="en" rdf:parseType="Literal"&gt;
      &lt;/ns0:description&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="sdf:FeatureClass1"&gt;
      &lt;ns0:LayerDefinitionResourceStream xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" xml:lang="en" rdf:parseType="Literal"&gt;
        &lt;LayerDefinition xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="LayerDefinition-2.4.0.xsd" version="2.4.0"&gt;
          &lt;VectorLayerDefinition&gt;
            &lt;ResourceId&gt;Library://SDF_1.FeatureSource&lt;/ResourceId&gt;
            &lt;FeatureName&gt;sdf:FeatureClass1&lt;/FeatureName&gt;
            &lt;FeatureNameType&gt;FeatureClass&lt;/FeatureNameType&gt;
            &lt;Geometry&gt;Geometry&lt;/Geometry&gt;  
      &lt;/VectorLayerDefinition&gt;
        &lt;/LayerDefinition&gt;
      &lt;/ns0:LayerDefinitionResourceStream&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="fsd://1"&gt;
      &lt;rdf:type rdf:resource="http://www.autodesk.com/gis/resource/definitions/FeatureSourceResource" /&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="fsd://1"&gt;
      &lt;ns0:name xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" xml:lang="en" rdf:parseType="Literal"&gt;1&lt;/ns0:name&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="fsd://1"&gt;
      &lt;ns0:isURL xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" xml:lang="en" rdf:parseType="Literal"&gt;no&lt;/ns0:isURL&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="fsd://1"&gt;
      &lt;ns0:description xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" xml:lang="en" rdf:parseType="Literal"&gt;
      &lt;/ns0:description&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="fsd://1"&gt;
      &lt;ns0:FeatureSourceResourceStream xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" xml:lang="en" rdf:parseType="Literal"&gt;    &lt;/ns0:FeatureSourceResourceStream&gt;
    &lt;/rdf:Description&gt;
    &lt;rdf:Description rdf:about="LayerSchema"&gt;
      &lt;ns0:version xmlns:ns0="http://www.autodesk.com/gis/resource/definitions/" xml:lang="en" rdf:parseType="Literal"&gt;1&lt;/ns0:version&gt;
    &lt;/rdf:Description&gt;
  &lt;/rdf:RDF&gt;
  </code></pre>
  
  <p>Here my code:  </p>
  
  <pre><code>public void Main()
  {
      XDocument doc = XDocument.Load(@"D:\Repositories\Library\Content\Layers\FeatureClass1.LayerDefinition");
      string str = doc.Element("VectorLatyerDefinition").Element("ResourceId").Value;
      doc.Element("VectorLayerDefinition").Element("ResourceId").Value = "SomeValue";
      doc.Save(@"D:\Repositories\Library\Content\Layers\FeatureClass1.LayerDefinition");
  }
  </code></pre>
  
  <p>But it works after I "cleaned" xml file</p>