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

NavigatorInput.cs « XsltOld « Xsl « Xml « System « System.Data.SqlXml « referencesource « class « mcs - github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ce6688e4d1d552eee8ea11e6ac7b2c747462452e (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
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
//------------------------------------------------------------------------------
// <copyright file="NavigatorInput.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;
    using Keywords = System.Xml.Xsl.Xslt.KeywordsTable;

    internal class NavigatorInput {
        private XPathNavigator     _Navigator;
        private PositionInfo       _PositionInfo;
        private InputScopeManager  _Manager;
        private NavigatorInput     _Next;
        private string             _Href;
        private Keywords           _Atoms;

        internal NavigatorInput Next {
            get {
                return _Next;
            }
            set {
                _Next = value;
            }
        }

        internal string Href {
            get {
                return _Href;
            }
        }

        internal Keywords Atoms {
            get {
                return _Atoms;
            }
        }        

        internal  XPathNavigator Navigator {
            get {
                AssertInput();
                return _Navigator;
            }
        }

        internal  InputScopeManager InputScopeManager {
            get {
                AssertInput();
                return _Manager;
            }
        }

        internal  bool Advance() {
            AssertInput();
            return _Navigator.MoveToNext();
        }

        internal  bool Recurse() {
            AssertInput();
            return _Navigator.MoveToFirstChild();
        }

        internal  bool ToParent() {
            AssertInput();
            return _Navigator.MoveToParent();
        }

        internal  void Close() {
            _Navigator = null;
            _PositionInfo = null;
        }

        //
        // Input document properties
        //

        //
        // XPathNavigator does not support line and position numbers
        //

        internal  int LineNumber { 
            get { return _PositionInfo.LineNumber; }
        }

        internal  int LinePosition { 
            get { return _PositionInfo.LinePosition; }
        }

        internal  XPathNodeType NodeType {
            get {
                AssertInput();
                return _Navigator.NodeType;
            }
        }

        internal  string Name {
            get {
                AssertInput();
                return _Navigator.Name;
            }
        }

        internal  string LocalName {
            get {
                AssertInput();
                return _Navigator.LocalName;
            }
        }

        internal  string NamespaceURI {
            get {
                AssertInput();
                return _Navigator.NamespaceURI;
            }
        }

        internal  string Prefix {
            get {
                AssertInput();
                return _Navigator.Prefix;
            }
        }

        internal  string Value {
            get {
                AssertInput();
                return _Navigator.Value;
            }
        }

        internal  bool IsEmptyTag {
            get {
                AssertInput();
                return _Navigator.IsEmptyElement;
            }
        }

        internal  string BaseURI {
            get {
                return  _Navigator.BaseURI;
            }
        }
        
        internal  bool MoveToFirstAttribute() {
            AssertInput();
            return _Navigator.MoveToFirstAttribute();
        }

        internal  bool MoveToNextAttribute() {
            AssertInput();
            return _Navigator.MoveToNextAttribute();
        }
        internal  bool MoveToFirstNamespace() {
            AssertInput();
            return _Navigator.MoveToFirstNamespace(XPathNamespaceScope.ExcludeXml);
        }

        internal  bool MoveToNextNamespace() {
            AssertInput();
            return _Navigator.MoveToNextNamespace(XPathNamespaceScope.ExcludeXml);
        }

        //
        // Constructor
        //
        internal NavigatorInput(XPathNavigator navigator, string baseUri, InputScope rootScope) {
            if (navigator == null) {
                throw new ArgumentNullException("navigator");
            }
            if (baseUri == null) {
                throw new ArgumentNullException("baseUri");
            }
            Debug.Assert(navigator.NameTable != null);
            _Next  = null;
            _Href  = baseUri;
            _Atoms = new Keywords(navigator.NameTable);
            _Navigator = navigator;
            _Manager   = new InputScopeManager(_Navigator, rootScope);
            _PositionInfo = PositionInfo.GetPositionInfo(_Navigator);

            /*BeginReading:*/
            AssertInput();
            if (NodeType == XPathNodeType.Root) {
                _Navigator.MoveToFirstChild();
            }
        }

        internal NavigatorInput(XPathNavigator navigator): this(navigator, navigator.BaseURI, null) {}

        //
        // Debugging support
        //
        [System.Diagnostics.Conditional("DEBUG")]
        internal void AssertInput() {
            Debug.Assert(_Navigator != null);
        }
    }
}