get xelement attribute value

var xml = @”<User ID=””11″” Name=””Juan Diaz”” LoginName=””DN1\jdiaz”” xmlns=””http://schemas.microsoft.com/sharepoint/soap/directory/”” />”; var user = XElement.Parse(xml); var login = user.Attribute(“LoginName”).Value; // “DN1\jdiaz”

Get the XPath to an XElement?

The extensions methods: public static class XExtensions { /// <summary> /// Get the absolute XPath to a given XElement /// (e.g. “/people/person[6]/name[1]/last[1]”). /// </summary> public static string GetAbsoluteXPath(this XElement element) { if (element == null) { throw new ArgumentNullException(“element”); } Func<XElement, string> relativeXPath = e => { int index = e.IndexPosition(); string name = e.Name.LocalName; … Read more

Children of XElement

The immediate child elements of one XElement are accessible by calling the Element() or Elements() functions. Use the overloads with a name to access specific elements, or without to access all child elements. There are also similar methods like Attribute() and Attributes() that you might find useful.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)