Class StringDecoratorExtensions
- Namespace
- Cuemon.Xml
- Assembly
- Cuemon.Xml.dll
Extension methods for the String class hidden behind the IDecorator<T> interface.
public static class StringDecoratorExtensions
- Inheritance
-
StringDecoratorExtensions
Methods
EscapeXml(IDecorator<String>)
Escapes the given XML of the enclosed String of the specified decorator
.
public static string EscapeXml(this IDecorator<string> decorator)
Parameters
decorator
IDecorator<String>The IDecorator<T> to extend.
Returns
Exceptions
- ArgumentNullException
decorator
cannot be null.
SanitizeXmlElementName(IDecorator<String>)
Sanitizes the enclosed String of the specified decorator
for any invalid characters.
public static string SanitizeXmlElementName(this IDecorator<string> decorator)
Parameters
decorator
IDecorator<String>The IDecorator<T> to extend.
Returns
Remarks
Sanitation rules are as follows:
- Names can contain letters, numbers, and these 4 characters: _ | : | . | -
- Names cannot start with a number or punctuation character
- Names cannot contain spaces
Exceptions
- ArgumentNullException
decorator
cannot be null.
SanitizeXmlElementText(IDecorator<String>, Boolean)
Sanitizes the enclosed String of the specified decorator
for any invalid characters.
public static string SanitizeXmlElementText(this IDecorator<string> decorator, bool cdataSection = false)
Parameters
decorator
IDecorator<String>The IDecorator<T> to extend.
cdataSection
Booleanif set to
true
supplemental CDATA-section rules is applied to the enclosed String of the specifieddecorator
.
Returns
Remarks
Sanitation rules are as follows:
Exceptions
- ArgumentNullException
decorator
cannot be null.
UnescapeXml(IDecorator<String>)
Unescapes the given XML of the enclosed String of the specified decorator
.
public static string UnescapeXml(this IDecorator<string> decorator)
Parameters
decorator
IDecorator<String>The IDecorator<T> to extend.
Returns
Exceptions
- ArgumentNullException
decorator
cannot be null.