internal void Init(string prefix, string nsUri, string prevDefaultNsUri, NamespaceDecl?next) { _prefix = prefix; _nsUri = nsUri; _prevDefaultNsUri = prevDefaultNsUri; _next = next; }
internal void PopScope() { OutputScope?elementScope = (OutputScope?)_elementScopesStack.Pop(); Debug.Assert(elementScope != null); // We're adding rootElementScope to gurantee this for (NamespaceDecl?scope = elementScope.Scopes; scope != null; scope = scope.Next) { _defaultNS = scope.PrevDefaultNsUri; } }
internal string?ResolveNonAtom(string prefix) { Debug.Assert(prefix != null && prefix.Length > 0); for (NamespaceDecl?scope = this.scopes; scope != null; scope = scope.Next) { if (scope.Prefix == prefix) { Debug.Assert(scope.Uri != null); return(scope.Uri); } } return(null); }
internal void PopScope() { Debug.Assert(_scopeStack != null, "Push/Pop disbalance"); if (_scopeStack == null) { return; } for (NamespaceDecl?scope = _scopeStack.Scopes; scope != null; scope = scope.Next) { _defaultNS = scope.PrevDefaultNsUri; } _scopeStack = _scopeStack.Parent; }
internal bool FindPrefix(string urn, out string prefix) { Debug.Assert(urn != null); for (NamespaceDecl?scope = this.scopes; scope != null; scope = scope.Next) { if (Ref.Equal(scope.Uri, urn) && scope.Prefix != null && scope.Prefix.Length > 0) { prefix = scope.Prefix; return(true); } } prefix = string.Empty; return(false); }
internal NamespaceDecl(string prefix, string nsUri, string prevDefaultNsUri, NamespaceDecl?next) { Init(prefix, nsUri, prevDefaultNsUri, next); }
internal NamespaceDecl AddNamespace(string prefix, string uri, string prevDefaultNsUri) { this.scopes = new NamespaceDecl(prefix, uri, prevDefaultNsUri, this.scopes); return(this.scopes); }