示例#1
0
        private void SetName(string local, string uri)
        {
            if (uri == null)
            {
                uri = string.Empty;
            }

            string[] names = (local ?? string.Empty).Split(':');
            if (names.Length == 1) // No colon found
            {
                this.Name         = names[0];
                this.NamespaceUri = uri;
            }
            else
            {
                this.Name         = names[1];
                this.NamespaceUri = KmlNamespaces.FindNamespace(names[0]) ?? uri;
                this.Prefix       = names[0];
            }
        }
示例#2
0
        private void SetName(string local, string uri)
        {
            if (uri == null)
            {
                uri = string.Empty;
            }

            local = local ?? string.Empty;
            int colon = local.IndexOf(':');

            if (colon < 0)
            {
                this.Name         = local;
                this.NamespaceUri = uri;
            }
            else
            {
                this.Name         = local.Substring(colon + 1);
                this.Prefix       = local.Substring(0, colon);
                this.NamespaceUri = KmlNamespaces.FindNamespace(this.Prefix) ?? uri;
            }
        }