System.Xml.Xsl.Runtime.XmlQueryOutput.EnsureValidName C# (CSharp) Method

EnsureValidName() private method

Ensure that the specified name parts are valid according to Xml 1.0 and Namespace 1.0 rules. Try to remap the prefix in order to attain validity. Throw if validity is not possible. Otherwise, return the (possibly remapped) prefix.
private EnsureValidName ( string prefix, string localName, string ns, XPathNodeType nodeType ) : string
prefix string
localName string
ns string
nodeType XPathNodeType
return string
        private string EnsureValidName(string prefix, string localName, string ns, XPathNodeType nodeType) {
            if (!ValidateNames.ValidateName(prefix, localName, ns, nodeType, ValidateNames.Flags.AllExceptNCNames)) {
                // Name parts are not valid as is.  Try to re-map the prefix.
                prefix = (ns.Length != 0) ? RemapPrefix(string.Empty, ns, nodeType == XPathNodeType.Element) : string.Empty;

                ValidateNames.ValidateNameThrow(prefix, localName, ns, nodeType, ValidateNames.Flags.AllExceptNCNames);
            }

            return prefix;
        }