XElementExtensions.GetElement method
| Namespace | Skybrud.Essentials.Xml.Extensions | 
|---|---|
| Assembly | Skybrud.Essentials.dll | 
GetElement(XElement, XName)
Gets the first XElement  matching the specified name.
public static XElement GetElement(this XElement element, XName name)
Parameters
GetElement<T>(XElement, XName, Func<T, TResult>)
Gets the first XElement  matching the specified name and parses it using callback.
public static T GetElement<T>(this XElement element, XName name, Func<T, TResult> callback)
Type Parameters
T
                        Parameters
A callback function for parsing the element.
Returns
T
                        An instance of T, or null if name doesn't match any elements.
GetElement(XElement, string)
Gets the first XElement  matching the specified expression.
public static XElement GetElement(this XElement element, string expression)
GetElement<T>(XElement, string, Func<T, TResult>)
Gets the first XElement  matching the specified expression and parses it using callback.
public static T GetElement<T>(this XElement element, string expression, Func<T, TResult> callback)
Type Parameters
T
                        Returns
T
                        An instance of T, or null if expression doesn't match any elements.
GetElement(XElement, string, IXmlNamespaceResolver)
Gets the first XElement  matching the specified expression.
public static XElement GetElement(this XElement element, string expression, IXmlNamespaceResolver resolver)
Parameters
expression
                                String 
                            The XPath expression.
resolver
                                IXmlNamespaceResolver 
                            An instance of IXmlNamespaceResolver for the namespace prefixes in the XPath expression.
GetElement<T>(XElement, string, IXmlNamespaceResolver, Func<T, TResult>)
Gets the first XElement  matching the specified expression and parses it using callback.
public static T GetElement<T>(this XElement element, string expression, IXmlNamespaceResolver resolver, Func<T, TResult> callback)
Type Parameters
T
                        Parameters
expression
                                String 
                            The XPath expression.
resolver
                                IXmlNamespaceResolver 
                            An instance of IXmlNamespaceResolver for the namespace prefixes in the XPath expression.
A callback function for parsing the element.
Returns
T
                        An instance of T, or null if expression doesn't match any elements.
GetElement<T>(XElement, string, IXmlNamespaceResolver, Func<T1, T2, TResult>)
Gets an instance of T representing the first element matching the specified XPath expression.
public static T GetElement<T>(this XElement element, string expression, IXmlNamespaceResolver resolver, Func<T1, T2, TResult> callback)
Type Parameters
T
                                The type of the item to be returned.
Parameters
expression
                                String 
                            The XPath expression.
resolver
                                IXmlNamespaceResolver 
                            An instance of IXmlNamespaceResolver for the namespace prefixes in the XPath expression.
A callback function for parsing the element.
Returns
T
                        An instance of T, or null if expression doesn't match any elements.
