This is my xml generated for retrieving members of a group. I need to get the value tech\abc1234 from this xml.
<tcm:Trustee xlink:href="tcm:0-61-65552" xlink:type="simple" xlink:title="tech\abc1234" Type="65552" Icon="T65552L0P0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:tcm="http://www.tridion.com/ContentManager/5.0"></tcm:Trustee>
But when i try to get the attribute value like:
XElement userList = csClient.GetListXml(grpId, members);
foreach (var eachuser in userList.Elements())
{
logdetails(eachuser.Attribute("xlink:title").Value.ToString());
}
I am getting the following error :
error The ':' character, hexadecimal value 0x3A, cannot be included in a name.
Currently, you’re using the
stringtoXNameconversion, which takes that string as just the local ID of an element, and that can’t contain a colon.You need to create an
XNamewith the full namespace + local ID. Fortunately, LINQ makes that really easy:Note that there’s no need to call
ToString()afterValue–XAttribute.Valuealready returns a string.