Updates referencesource to .NET 4.7
[mono-project.git] / mcs / class / referencesource / System.Data.SqlXml / System / Xml / Xsl / XsltOld / NamespaceEvent.cs
blobeeeeb6faf265e3108a2332144b14be8185900084
1 //------------------------------------------------------------------------------
2 // <copyright file="NameSpaceEvent.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
4 // </copyright>
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
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 using System.Xml.XPath;
15 internal class NamespaceEvent : Event {
16 private string namespaceUri;
17 private string name;
19 public NamespaceEvent(NavigatorInput input) {
20 Debug.Assert(input != null);
21 Debug.Assert(input.NodeType == XPathNodeType.Namespace);
22 this.namespaceUri = input.Value;
23 this.name = input.LocalName;
26 public override void ReplaceNamespaceAlias(Compiler compiler){
27 if (this.namespaceUri.Length != 0) { // Do we need to check this for namespace?
28 NamespaceInfo ResultURIInfo = compiler.FindNamespaceAlias(this.namespaceUri);
29 if (ResultURIInfo != null) {
30 this.namespaceUri = ResultURIInfo.nameSpace;
31 if (ResultURIInfo.prefix != null) {
32 this.name = ResultURIInfo.prefix;
38 public override bool Output(Processor processor, ActionFrame frame) {
39 bool res;
40 res = processor.BeginEvent(XPathNodeType.Namespace, /*prefix:*/null, this.name, this.namespaceUri, /*empty:*/false);
41 Debug.Assert(res); // Namespace node as any other attribute can't fail because it doesn't signal record change
42 res = processor.EndEvent(XPathNodeType.Namespace);
43 Debug.Assert(res);
44 return true;