Updates referencesource to .NET 4.7
[mono.git] / mcs / class / referencesource / System.Data.SqlXml / System / Xml / Xsl / XsltOld / OutputScope.cs
1 //------------------------------------------------------------------------------
2 // <copyright file="OutputScope.cs" company="Microsoft">
3 //     Copyright (c) Microsoft Corporation.  All rights reserved.
4 // </copyright>                                                                
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
7
8 namespace System.Xml.Xsl.XsltOld {
9     using Res = System.Xml.Utils.Res;
10     using System;
11     using System.Diagnostics;
12     using System.Xml;
13
14     internal class OutputScope : DocumentScope {
15         private string           name;
16         private string           nsUri;
17         private string           prefix;
18         private XmlSpace         space;
19         private string           lang;
20         private bool             mixed;
21         private bool             toCData;
22         private HtmlElementProps htmlElementProps; // in HTML output -- atomized name of element
23
24         internal string Name {
25             get { return this.name; }
26         }
27         internal string Namespace {
28             get { return this.nsUri; }
29         }
30         internal string Prefix {
31             get { return this.prefix; }
32             set { this.prefix = value; }
33         }
34         internal XmlSpace Space {
35             get { return this.space; }
36             set { this.space = value; }
37         }
38         internal string Lang {
39             get { return this.lang; }
40             set { this.lang = value; }
41         }
42         internal bool Mixed {
43             get { return this.mixed; }
44             set { this.mixed = value; }
45         }
46         internal bool ToCData {
47             get { return this.toCData; }
48             set { this.toCData = value; }
49         }
50         internal HtmlElementProps HtmlElementProps {
51             get { return this.htmlElementProps; }
52             set { this.htmlElementProps = value; }
53         }
54
55         internal OutputScope() {
56             Init(string.Empty, string.Empty, string.Empty, XmlSpace.None, string.Empty, false);
57         }
58
59         internal void Init(string name, string nspace, string prefix, XmlSpace space, string lang, bool mixed) {
60             this.scopes           = null;
61             this.name             = name;
62             this.nsUri            = nspace;
63             this.prefix           = prefix;
64             this.space            = space;
65             this.lang             = lang;
66             this.mixed            = mixed;
67             this.toCData          = false;
68             this.htmlElementProps = null;
69         }
70
71         internal bool FindPrefix(string urn, out string prefix) {
72             Debug.Assert(urn != null);
73
74             for (NamespaceDecl scope = this.scopes; scope != null; scope = scope.Next) {
75                 if (Ref.Equal(scope.Uri, urn) &&
76                     scope.Prefix != null            &&
77                     scope.Prefix.Length > 0) {
78                     prefix = scope.Prefix;
79                     return true;
80                 }
81             }
82
83             prefix = string.Empty;
84             return false;
85         }
86     }
87 }