• Core
  • Infrastructure
  • Web
  • Extensions
Search Results for

    Show / Hide Table of Contents
    View Source

    Class XmlExtensions

    Extension methods for xml objects

    Inheritance
    System.Object
    Namespace: Umbraco.Extensions
    Assembly: Umbraco.Core.dll
    Syntax
    public static class XmlExtensions

    Methods

    View Source

    AttributeValue<T>(XElement, String)

    Declaration
    public static T AttributeValue<T>(this XElement xml, string attributeName)
    Parameters
    Type Name Description
    System.Xml.Linq.XElement xml
    System.String attributeName
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    AttributeValue<T>(XmlNode, String)

    Declaration
    public static T AttributeValue<T>(this XmlNode xml, string attributeName)
    Parameters
    Type Name Description
    System.Xml.XmlNode xml
    System.String attributeName
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    GetXElement(XmlNode)

    Declaration
    public static XElement GetXElement(this XmlNode node)
    Parameters
    Type Name Description
    System.Xml.XmlNode node
    Returns
    Type Description
    System.Xml.Linq.XElement
    View Source

    GetXmlNode(XContainer)

    Declaration
    public static XmlNode GetXmlNode(this XContainer element)
    Parameters
    Type Name Description
    System.Xml.Linq.XContainer element
    Returns
    Type Description
    System.Xml.XmlNode
    View Source

    GetXmlNode(XContainer, XmlDocument)

    Declaration
    public static XmlNode GetXmlNode(this XContainer element, XmlDocument xmlDoc)
    Parameters
    Type Name Description
    System.Xml.Linq.XContainer element
    System.Xml.XmlDocument xmlDoc
    Returns
    Type Description
    System.Xml.XmlNode
    View Source

    HasAttribute(XmlAttributeCollection, String)

    Declaration
    public static bool HasAttribute(this XmlAttributeCollection attributes, string attributeName)
    Parameters
    Type Name Description
    System.Xml.XmlAttributeCollection attributes
    System.String attributeName
    Returns
    Type Description
    System.Boolean
    View Source

    RequiredAttributeValue<T>(XElement, String)

    Declaration
    public static T RequiredAttributeValue<T>(this XElement xml, string attributeName)
    Parameters
    Type Name Description
    System.Xml.Linq.XElement xml
    System.String attributeName
    Returns
    Type Description
    T
    Type Parameters
    Name Description
    T
    View Source

    SelectNodes(XmlNode, String, Nullable<IEnumerable<XPathVariable>>)

    Selects a list of XmlNode matching an XPath expression.

    Declaration
    public static XmlNodeList SelectNodes(this XmlNode source, string expression, IEnumerable<XPathVariable>? variables)
    Parameters
    Type Name Description
    System.Xml.XmlNode source

    A source XmlNode.

    System.String expression

    An XPath expression.

    System.Nullable<IEnumerable<XPathVariable>> variables

    A set of XPathVariables.

    Returns
    Type Description
    System.Xml.XmlNodeList

    The list of XmlNode matching the XPath expression.

    Remarks

    If is null, or is empty, or contains only one single value which itself is null, then variables are ignored.

    The XPath expression should reference variables as $var.

    View Source

    SelectNodes(XmlNode, String, XPathVariable[])

    Selects a list of XmlNode matching an XPath expression.

    Declaration
    public static XmlNodeList SelectNodes(this XmlNode source, string expression, params XPathVariable[] variables)
    Parameters
    Type Name Description
    System.Xml.XmlNode source

    A source XmlNode.

    System.String expression

    An XPath expression.

    XPathVariable[] variables

    A set of XPathVariables.

    Returns
    Type Description
    System.Xml.XmlNodeList

    The list of XmlNode matching the XPath expression.

    Remarks

    If is null, or is empty, or contains only one single value which itself is null, then variables are ignored.

    The XPath expression should reference variables as $var.

    View Source

    SelectNodes(XmlNode, XPathExpression, Nullable<IEnumerable<XPathVariable>>)

    Selects a list of XmlNode matching an XPath expression.

    Declaration
    public static XmlNodeList SelectNodes(this XmlNode source, XPathExpression expression, IEnumerable<XPathVariable>? variables)
    Parameters
    Type Name Description
    System.Xml.XmlNode source

    A source XmlNode.

    System.Xml.XPath.XPathExpression expression

    An XPath expression.

    System.Nullable<IEnumerable<XPathVariable>> variables

    A set of XPathVariables.

    Returns
    Type Description
    System.Xml.XmlNodeList

    The list of XmlNode matching the XPath expression.

    Remarks

    If is null, or is empty, or contains only one single value which itself is null, then variables are ignored.

    The XPath expression should reference variables as $var.

    View Source

    SelectNodes(XmlNode, XPathExpression, XPathVariable[])

    Selects a list of XmlNode matching an XPath expression.

    Declaration
    public static XmlNodeList SelectNodes(this XmlNode source, XPathExpression expression, params XPathVariable[] variables)
    Parameters
    Type Name Description
    System.Xml.XmlNode source

    A source XmlNode.

    System.Xml.XPath.XPathExpression expression

    An XPath expression.

    XPathVariable[] variables

    A set of XPathVariables.

    Returns
    Type Description
    System.Xml.XmlNodeList

    The list of XmlNode matching the XPath expression.

    Remarks

    If is null, or is empty, or contains only one single value which itself is null, then variables are ignored.

    The XPath expression should reference variables as $var.

    View Source

    SelectSingleNode(XmlNode, String, Nullable<IEnumerable<XPathVariable>>)

    Selects the first XmlNode that matches an XPath expression.

    Declaration
    public static XmlNode SelectSingleNode(this XmlNode source, string expression, IEnumerable<XPathVariable>? variables)
    Parameters
    Type Name Description
    System.Xml.XmlNode source

    A source XmlNode.

    System.String expression

    An XPath expression.

    System.Nullable<IEnumerable<XPathVariable>> variables

    A set of XPathVariables.

    Returns
    Type Description
    System.Xml.XmlNode

    The first XmlNode that matches the XPath expression.

    Remarks

    If is null, or is empty, or contains only one single value which itself is null, then variables are ignored.

    The XPath expression should reference variables as $var.

    View Source

    SelectSingleNode(XmlNode, String, XPathVariable[])

    Selects the first XmlNode that matches an XPath expression.

    Declaration
    public static XmlNode SelectSingleNode(this XmlNode source, string expression, params XPathVariable[] variables)
    Parameters
    Type Name Description
    System.Xml.XmlNode source

    A source XmlNode.

    System.String expression

    An XPath expression.

    XPathVariable[] variables

    A set of XPathVariables.

    Returns
    Type Description
    System.Xml.XmlNode

    The first XmlNode that matches the XPath expression.

    Remarks

    If is null, or is empty, or contains only one single value which itself is null, then variables are ignored.

    The XPath expression should reference variables as $var.

    View Source

    SelectSingleNode(XmlNode, XPathExpression, Nullable<IEnumerable<XPathVariable>>)

    Selects the first XmlNode that matches an XPath expression.

    Declaration
    public static XmlNode SelectSingleNode(this XmlNode source, XPathExpression expression, IEnumerable<XPathVariable>? variables)
    Parameters
    Type Name Description
    System.Xml.XmlNode source

    A source XmlNode.

    System.Xml.XPath.XPathExpression expression

    An XPath expression.

    System.Nullable<IEnumerable<XPathVariable>> variables

    A set of XPathVariables.

    Returns
    Type Description
    System.Xml.XmlNode

    The first XmlNode that matches the XPath expression.

    Remarks

    If is null, or is empty, or contains only one single value which itself is null, then variables are ignored.

    The XPath expression should reference variables as $var.

    View Source

    SelectSingleNode(XmlNode, XPathExpression, XPathVariable[])

    Selects the first XmlNode that matches an XPath expression.

    Declaration
    public static XmlNode SelectSingleNode(this XmlNode source, XPathExpression expression, params XPathVariable[] variables)
    Parameters
    Type Name Description
    System.Xml.XmlNode source

    A source XmlNode.

    System.Xml.XPath.XPathExpression expression

    An XPath expression.

    XPathVariable[] variables

    A set of XPathVariables.

    Returns
    Type Description
    System.Xml.XmlNode

    The first XmlNode that matches the XPath expression.

    Remarks

    If is null, or is empty, or contains only one single value which itself is null, then variables are ignored.

    The XPath expression should reference variables as $var.

    View Source

    ToDataString(XElement)

    Declaration
    public static string ToDataString(this XElement xml)
    Parameters
    Type Name Description
    System.Xml.Linq.XElement xml
    Returns
    Type Description
    System.String
    View Source

    ToXDocument(XmlDocument)

    Converts from an XmlDocument to an XDocument

    Declaration
    public static XDocument ToXDocument(this XmlDocument xmlDocument)
    Parameters
    Type Name Description
    System.Xml.XmlDocument xmlDocument
    Returns
    Type Description
    System.Xml.Linq.XDocument
    View Source

    ToXElement(XmlNode)

    Converts from an XmlElement to an XElement

    Declaration
    public static XElement ToXElement(this XmlNode xmlElement)
    Parameters
    Type Name Description
    System.Xml.XmlNode xmlElement
    Returns
    Type Description
    System.Xml.Linq.XElement
    View Source

    ToXmlDocument(XDocument)

    Converts from an XDocument to an XmlDocument

    Declaration
    public static XmlDocument ToXmlDocument(this XDocument xDocument)
    Parameters
    Type Name Description
    System.Xml.Linq.XDocument xDocument
    Returns
    Type Description
    System.Xml.XmlDocument
    View Source

    ToXmlElement(XContainer)

    Declaration
    public static XmlNode ToXmlElement(this XContainer xElement)
    Parameters
    Type Name Description
    System.Xml.Linq.XContainer xElement
    Returns
    Type Description
    System.Xml.XmlNode
    • Improve this Doc
    • View Source
    In This Article
    • Methods
      • AttributeValue<T>(XElement, String)
      • AttributeValue<T>(XmlNode, String)
      • GetXElement(XmlNode)
      • GetXmlNode(XContainer)
      • GetXmlNode(XContainer, XmlDocument)
      • HasAttribute(XmlAttributeCollection, String)
      • RequiredAttributeValue<T>(XElement, String)
      • SelectNodes(XmlNode, String, Nullable<IEnumerable<XPathVariable>>)
      • SelectNodes(XmlNode, String, XPathVariable[])
      • SelectNodes(XmlNode, XPathExpression, Nullable<IEnumerable<XPathVariable>>)
      • SelectNodes(XmlNode, XPathExpression, XPathVariable[])
      • SelectSingleNode(XmlNode, String, Nullable<IEnumerable<XPathVariable>>)
      • SelectSingleNode(XmlNode, String, XPathVariable[])
      • SelectSingleNode(XmlNode, XPathExpression, Nullable<IEnumerable<XPathVariable>>)
      • SelectSingleNode(XmlNode, XPathExpression, XPathVariable[])
      • ToDataString(XElement)
      • ToXDocument(XmlDocument)
      • ToXElement(XmlNode)
      • ToXmlDocument(XDocument)
      • ToXmlElement(XContainer)
    Back to top Copyright © 2016-present Umbraco
    Generated by DocFX