System.Xml.XmlConvert.VerifyNCName C# (CSharp) Méthode

VerifyNCName() public static méthode

public static VerifyNCName ( string name ) : string
name string
Résultat string
        public static string VerifyNCName(string name)
        {
            return VerifyNCName(name, ExceptionType.XmlException);
        }

Same methods

XmlConvert::VerifyNCName ( string name, ExceptionType exceptionType ) : string

Usage Example

Exemple #1
0
        internal void WriteQualifiedNameInternal(string localName, string ns)
        {
            if (localName == null || localName == String.Empty)
            {
                throw new ArgumentException();
            }
            if (ns == null)
            {
                ns = String.Empty;
            }

#if NET_2_0
            if (Settings != null)
            {
                switch (Settings.ConformanceLevel)
                {
                case ConformanceLevel.Document:
                case ConformanceLevel.Fragment:
                    XmlConvert.VerifyNCName(localName);
                    break;
                }
            }
            else
            {
                XmlConvert.VerifyNCName(localName);
            }
#else
            XmlConvert.VerifyNCName(localName);
#endif

            string prefix = ns.Length > 0 ? LookupPrefix(ns) : String.Empty;
            if (prefix == null)
            {
                throw new ArgumentException(String.Format("Namespace '{0}' is not declared.", ns));
            }

            if (prefix != String.Empty)
            {
                WriteString(prefix);
                WriteString(":");
                WriteString(localName);
            }
            else
            {
                WriteString(localName);
            }
        }
All Usage Examples Of System.Xml.XmlConvert::VerifyNCName