Table of Contents

Class XElementExtension

Namespace
Loehnert.Utility.Extensions
Assembly
Loehnert.Utility.dll

Extensions for the XElement class.

public static class XElementExtension
Inheritance
XElementExtension
Inherited Members

Methods

GetAttribute(XElement, string)

Gets an attribute of an note by attribute name and throws an FileFormatException when it is not found.

public static string GetAttribute(this XElement note, string attributeName)

Parameters

note XElement

XML element with the attribute.

attributeName string

Name of the attribute.

Returns

string

Value of the attribute.

Exceptions

FileFormatException

Thrown when note doesn't have the attribute with the attributeName.

ArgumentNullException

Thrown when attributeName is null or empty.

GetPosition(IXmlLineInfo)

Gets a string containing the line and column number.

public static string GetPosition(this IXmlLineInfo lineInfoElement)

Parameters

lineInfoElement IXmlLineInfo

The element. (E. g. XElement or any XObject).

Returns

string

A text with line and column number or Empty if HasLineInfo() is false.