System.Xml.XmlReader.LookupNamespace C# (CSharp) Method

LookupNamespace() public abstract method

public abstract LookupNamespace ( string prefix ) : string
prefix string
return string
        public abstract string LookupNamespace(string prefix);

Usage Example

Example #1
0
        internal static XName ToXName(this string self, XmlReader reader)
        {
            var i = self.IndexOf(':');
            if (i == 0 || i == self.Length - 1)
            {
                throw new XmlException($"\"{self}\" is not QName.");
            }

            var prefix = string.Empty;
            var localPart = string.Empty;

            if (i < 0)
            {
                localPart = self;
            }
            else
            {
                prefix = self.Substring(0, i);
                localPart = self.Substring(i + 1);
            }

            XNamespace ns = reader.LookupNamespace(prefix);
            if (ns == null)
            {
                throw new XmlException($"The prefix \"{prefix}\" is not declared.");
            }

            return ns + localPart;
        }
All Usage Examples Of System.Xml.XmlReader::LookupNamespace