Show / Hide Table of Contents

    Class XmlUtilityExtensions

    Extension methods for the XmlUtility class.

    Inheritance
    System.Object
    XmlUtilityExtensions
    Namespace: Cuemon.Xml
    Assembly: Cuemon.Xml.dll
    Syntax
    public static class XmlUtilityExtensions

    Methods

    | Improve this Doc

    EscapeXml(String)

    Escapes the given XML System.String.

    Declaration
    public static string EscapeXml(this string value)
    Parameters
    Type Name Description
    System.String value

    The XML System.String to escape.

    Returns
    Type Description
    System.String

    The input value with an escaped equivalent.

    | Improve this Doc

    RemoveXmlNamespaceDeclarations(Stream)

    Remove the XML namespace declarations from the specified System.IO.Stream value.

    Declaration
    public static Stream RemoveXmlNamespaceDeclarations(this Stream value)
    Parameters
    Type Name Description
    System.IO.Stream value

    An XML System.IO.Stream to purge namespace declarations from.

    Returns
    Type Description
    System.IO.Stream

    A System.IO.Stream object representing the specified value but with no namespace declarations.

    | Improve this Doc

    RemoveXmlNamespaceDeclarations(Stream, Boolean)

    Remove the XML namespace declarations from the specified System.IO.Stream value.

    Declaration
    public static Stream RemoveXmlNamespaceDeclarations(this Stream value, bool omitXmlDeclaration)
    Parameters
    Type Name Description
    System.IO.Stream value

    An XML System.IO.Stream to purge namespace declarations from.

    System.Boolean omitXmlDeclaration

    if set to true omit the XML declaration; otherwise false. The default is false.

    Returns
    Type Description
    System.IO.Stream

    A System.IO.Stream object representing the specified value but with no namespace declarations.

    | Improve this Doc

    RemoveXmlNamespaceDeclarations(Stream, Boolean, Encoding)

    Remove the XML namespace declarations from the specified System.IO.Stream value.

    Declaration
    public static Stream RemoveXmlNamespaceDeclarations(this Stream value, bool omitXmlDeclaration, Encoding encoding)
    Parameters
    Type Name Description
    System.IO.Stream value

    An XML System.IO.Stream to purge namespace declarations from.

    System.Boolean omitXmlDeclaration

    if set to true omit the XML declaration; otherwise false. The default is false.

    System.Text.Encoding encoding

    The text encoding to use.

    Returns
    Type Description
    System.IO.Stream

    A System.IO.Stream object representing the specified value but with no namespace declarations.

    | Improve this Doc

    SanitizeElementName(String)

    Sanitizes the elementName for any invalid characters.

    Declaration
    public static string SanitizeElementName(this string elementName)
    Parameters
    Type Name Description
    System.String elementName

    The name of the XML element to sanitize.

    Returns
    Type Description
    System.String

    A sanitized System.String of elementName.

    Remarks

    Sanitation rules are as follows:

    1. Names can contain letters, numbers, and these 4 characters: _ | : | . | -
    2. Names cannot start with a number or punctuation character
    3. Names cannot contain spaces
    | Improve this Doc

    SanitizeElementText(String)

    Sanitizes the text for any invalid characters.

    Declaration
    public static string SanitizeElementText(this string text)
    Parameters
    Type Name Description
    System.String text

    The content of an XML element to sanitize.

    Returns
    Type Description
    System.String

    A sanitized System.String of text.

    Remarks

    The text is sanitized for characters less or equal to a Unicode value of U+0019 (except U+0009, U+0010, U+0013).

    | Improve this Doc

    SanitizeElementText(String, Boolean)

    Sanitizes the text for any invalid characters.

    Declaration
    public static string SanitizeElementText(this string text, bool cdataSection)
    Parameters
    Type Name Description
    System.String text

    The content of an XML element to sanitize.

    System.Boolean cdataSection

    if set to true supplemental CDATA-section rules is applied to text.

    Returns
    Type Description
    System.String

    A sanitized System.String of text.

    Remarks

    Sanitation rules are as follows:

    1. The text cannot contain characters less or equal to a Unicode value of U+0019 (except U+0009, U+0010, U+0013)
    2. The text cannot contain the string "]]<" if cdataSection is true.
    | Improve this Doc

    UnescapeXml(String)

    Unescapes the given XML System.String.

    Declaration
    public static string UnescapeXml(this string value)
    Parameters
    Type Name Description
    System.String value

    The XML System.String to unescape.

    Returns
    Type Description
    System.String

    The input value with an unescaped equivalent.

    • Improve this Doc
    • View Source
    Back to top Copyright 2008-2018 Weubphoria. All rights reserved.
    Generated by DocFX