Ejemplo n.º 1
0
            public void Add(XmlParser xmlParser, Span aliasSpan, Span quotedSpan)
            {
                var valueSpan = new Span(quotedSpan.Start + 1, quotedSpan.Length - 2);
                var def       = new XmlNamespaceDefinition(xmlParser.GetSubstring(aliasSpan), xmlParser.GetSubstring(new Span(quotedSpan.Start + 1, quotedSpan.Length - 2)));

                if (!namespaces.ContainsKey(def.Alias))
                {
                    namespaces.Add(def.Alias, def);
                }
            }
Ejemplo n.º 2
0
            public void Add(string text, Span aliasSpan, Span quotedSpan)
            {
                var valueSpan = new Span(quotedSpan.Start + 1, quotedSpan.Length - 2);
                var def       = new XmlNamespaceDefinition(text.Substring(aliasSpan.Start, aliasSpan.Length), text.Substring(quotedSpan.Start + 1, quotedSpan.Length - 2));

                if (!namespaces.ContainsKey(def.Alias))
                {
                    namespaces.Add(def.Alias, def);
                }
            }
Ejemplo n.º 3
0
            public XmlNamespaceDefinition GetOrCreate(string xmlNsAlias)
            {
                var curr = this;
                XmlNamespaceDefinition def;

                while (curr != null)
                {
                    if (curr.namespaces.TryGetValue(xmlNsAlias, out def))
                    {
                        return(def);
                    }
                    curr = curr.previous;
                }
                def = new XmlNamespaceDefinition(xmlNsAlias, "???");
                namespaces.Add(xmlNsAlias, def);
                return(def);
            }