Skip to content

Simplify.Xml

Alexanderius edited this page Jun 25, 2026 · 5 revisions

Simplify.Xml Documentation

Provides XML extension functions and XmlSerializer.

Available at NuGet as binary package or source package

XML extensions

// Gets the outer XML string of an XNode (inner XML and itself).
public static string OuterXml(this XNode element);

// Gets the inner XML string of an XNode.
public static string InnerXml(this XNode element);

// Gets the descendant element using an XPath 1.0 expression.
public static XElement? Get(this XNode? node, string xpath);
public static XElement? Get(this XNode? node, string xpath, IXmlNamespaceResolver? resolver);

// Gets the collection of descendant elements using an XPath 1.0 expression.
public static IEnumerable<XElement> GetMany(this XNode? node, string xpath);
public static IEnumerable<XElement> GetMany(this XNode? node, string xpath, IXmlNamespaceResolver? resolver);

// Removes all XML namespaces from a string containing XML data.
public static string RemoveAllXmlNamespaces(this string xmlData);

XmlSerializer

// Serializes the specified items list to a XML string.
public static string Serialize<T>(IList<T> items);

// Serialize the object to XElement.
public static XElement ToXElement<T>(T obj);

// Deserialize the XElement to object.
public static T FromXElement<T>(XElement xElement);

Clone this wiki locally