536cd135cc
Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
53 lines
1.8 KiB
C#
53 lines
1.8 KiB
C#
//------------------------------------------------------------------------------
|
|
// <copyright file="DocumentScope.cs" company="Microsoft">
|
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
|
// </copyright>
|
|
// <owner current="true" primary="true">Microsoft</owner>
|
|
//------------------------------------------------------------------------------
|
|
|
|
namespace System.Xml.Xsl.XsltOld {
|
|
using Res = System.Xml.Utils.Res;
|
|
using System;
|
|
using System.Diagnostics;
|
|
using System.Xml;
|
|
using System.Xml.XPath;
|
|
|
|
internal class DocumentScope {
|
|
protected NamespaceDecl scopes;
|
|
|
|
internal NamespaceDecl Scopes {
|
|
get { return this.scopes; }
|
|
}
|
|
|
|
internal NamespaceDecl AddNamespace(string prefix, string uri, string prevDefaultNsUri) {
|
|
this.scopes = new NamespaceDecl(prefix, uri, prevDefaultNsUri, this.scopes);
|
|
return this.scopes;
|
|
}
|
|
|
|
internal string ResolveAtom(string prefix) {
|
|
Debug.Assert(prefix != null && prefix.Length > 0);
|
|
|
|
for (NamespaceDecl scope = this.scopes; scope != null; scope = scope.Next) {
|
|
if (Ref.Equal(scope.Prefix, prefix)) {
|
|
Debug.Assert(scope.Uri != null);
|
|
return scope.Uri;
|
|
}
|
|
}
|
|
|
|
return null;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
}
|