Table of Contents

SanitizeXmlElementName Method

Definition

Namespace
Cuemon.Xml
Assemblies
Cuemon.Xml.dll
Source
src/Cuemon.Xml/Extensions/StringDecoratorExtensions.cs

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

string

A sanitized string of the enclosed string of the specified decorator.

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

Exceptions

ArgumentNullException

decorator cannot be null.