System.Xml.ValidateNames.ParseQNameThrow C# (CSharp) Méthode

ParseQNameThrow() static private méthode

Calls parseQName and throws exception if the resulting name is not a valid QName. Returns the prefix and local name parts.
static private ParseQNameThrow ( string s, string &prefix, string &localName ) : void
s string
prefix string
localName string
Résultat void
        internal static void ParseQNameThrow(string s, out string prefix, out string localName)
        {
            int colonOffset;
            int len = ParseQName(s, 0, out colonOffset);

            if (len == 0 || len != s.Length)
            {
                // If the string is not a valid QName, then throw
                ThrowInvalidName(s, 0, len);
            }

            if (colonOffset != 0)
            {
                prefix = s.Substring(0, colonOffset);
                localName = s.Substring(colonOffset + 1);
            }
            else
            {
                prefix = "";
                localName = s;
            }
        }

Usage Example

Exemple #1
0
        private void ValidateQName(string name)
        {
            string str;
            string str2;

            ValidateNames.ParseQNameThrow(name, out str, out str2);
        }
All Usage Examples Of System.Xml.ValidateNames::ParseQNameThrow