Welcome to mirror list, hosted at ThFree Co, Russian Federation.

SchemaEntity.cs « Schema « Xml « System « System.Xml « referencesource « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: c0c96d0d9b34076dc104c9850695289abe73e180 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
//------------------------------------------------------------------------------
// <copyright file="SchemaEntity.cs" company="Microsoft">
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// </copyright>   
// <owner current="true" primary="true">[....]</owner>                                                                                                                            
//------------------------------------------------------------------------------

namespace System.Xml.Schema {

    using System;
    using System.Diagnostics;

    internal sealed class SchemaEntity : IDtdEntityInfo {
        private XmlQualifiedName qname;      // Name of entity
        private String url;                  // Url for external entity (system id)
        private String pubid;                // Pubid for external entity
        private String text;                 // Text for internal entity
        private XmlQualifiedName  ndata = XmlQualifiedName.Empty; // NDATA identifier
        private int    lineNumber;           // line number
        private int    linePosition;         // character postion
        private bool   isParameter;          // parameter entity flag
        private bool   isExternal;           // external entity flag
        private bool parsingInProgress;      // whether entity is being parsed (DtdParser infinite recursion check)
        private bool isDeclaredInExternal; // declared in external markup or not
        private string baseURI;
        private string declaredURI;

//
// Constructor
//
        internal SchemaEntity(XmlQualifiedName qname, bool isParameter) {
            this.qname = qname;
            this.isParameter = isParameter;
        }

//
// IDtdEntityInfo interface
//
#region IDtdEntityInfo Members

        string IDtdEntityInfo.Name {
            get { return this.Name.Name; }
        }

        bool IDtdEntityInfo.IsExternal {
            get { return ((SchemaEntity)this).IsExternal;}
        }

        bool IDtdEntityInfo.IsDeclaredInExternal {
            get { return this.DeclaredInExternal; }
        }

        bool IDtdEntityInfo.IsUnparsedEntity {
            get { return !this.NData.IsEmpty; }
        }

        bool IDtdEntityInfo.IsParameterEntity {
            get { return isParameter; }
        }

        string IDtdEntityInfo.BaseUriString {
            get { return this.BaseURI; }
        }

        string IDtdEntityInfo.DeclaredUriString {
            get { return this.DeclaredURI; }
        }

        string IDtdEntityInfo.SystemId {
            get { return this.Url; }
        }

        string IDtdEntityInfo.PublicId {
            get { return this.Pubid; }
        }

        string IDtdEntityInfo.Text {
            get { return ((SchemaEntity)this).Text; }
        }

        int IDtdEntityInfo.LineNumber {
            get { return this.Line; }
        }

        int IDtdEntityInfo.LinePosition {
            get { return this.Pos; }
        }

#endregion

//
// Internal methods and properties
//
#if !SILVERLIGHT
        internal static bool IsPredefinedEntity(String n) {
            return(n == "lt" ||
                   n == "gt" ||
                   n == "amp" ||
                   n == "apos" ||
                   n == "quot");
        }
#endif

        internal XmlQualifiedName Name {
            get { return qname; }
        }

        internal String Url {
            get { return url;}
            set { url = value; isExternal = true;} 
        }

        internal String Pubid {
            get { return pubid;}
            set { pubid = value;}
        }

        internal bool IsExternal {
            get { return isExternal; }
            set { isExternal = value; }
        }

        internal bool DeclaredInExternal {
            get { return isDeclaredInExternal; }
            set { isDeclaredInExternal = value; }
        }

        internal XmlQualifiedName NData {
            get { return ndata;}
            set { ndata = value;}
        }

        internal String Text {
            get { return text;}
            set { text = value; isExternal = false;}
        }

        internal int Line {
            get { return lineNumber;}
            set { lineNumber = value;}    
        }

        internal int Pos {
            get { return linePosition;}
            set { linePosition = value;}
        }

        internal String BaseURI {
            get { return (baseURI == null) ? String.Empty : baseURI; }
            set { baseURI = value; }
        }

        internal bool ParsingInProgress {
            get { return parsingInProgress; }
            set { parsingInProgress = value; }
        }

        internal String DeclaredURI {
            get { return (declaredURI == null) ? String.Empty : declaredURI; }
            set { declaredURI = value; }
        }
    };

}