XElementExtensions.GetAttribute method

Version 1.1.28
.NET Framework 4.8
Namespace Skybrud.Essentials.Xml.Extensions
Assembly Skybrud.Essentials.dll

GetAttribute(XElement, XName)

Extension method

Gets the first attribute matching the the specified name.

public static XAttribute GetAttribute(this XElement element, XName name)

Parameters

element XElement

The instance of XElement holding the attribute.

name XName

An instance of XName identifying the attribute.

Returns

An instance of XAttribute , or null if no attributes were matched.

GetAttribute(XElement, string)

Extension method

Gets the first attribute matching the the specified XPath expression.

public static XAttribute GetAttribute(this XElement element, string expression)

Parameters

element XElement

An instance of XElement .

expression String

The XPath expression to match.

Returns

An instance of XAttribute , or null if no attributes were matched.

GetAttribute(XElement, string, IXmlNamespaceResolver)

Extension method

Gets the first attribute matching the the specified XPath expression.

public static XAttribute GetAttribute(this XElement element, string expression, IXmlNamespaceResolver resolver)

Parameters

element XElement

An instance of XElement .

expression String

The XPath expression to match.

An instance of IXmlNamespaceResolver for the namespace prefixes in the XPath expression.

Returns

An instance of XAttribute , or null if no attributes were matched.