The XML component in Tridion has the following format:
<Content xmlns="uuid:2607D20D-1B22-4994-98C1-66D9ACF85C20">
<first>The value of my first field</first>
<second>The value of my second field</second>
</Content>
Your corresponding code snippet:
var element = xdoc.Elements("first").Single();
This does not allow you to select an item, since it:
- does not provide a namespace for selection
- only selection of direct children of the root document
, , , , . XML, , .
, :
XNamespace ns = xdoc.Root.GetDefaultNamespace();
var element = xdoc.Descendants(ns+"first").Single();
, .NET- XML XML , , - .
, XML Core Service, .
, , , XDocument.Save, . , XML .