1 //------------------------------------------------------------------------------
2 // <copyright file="NameSpaceEvent.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 // <owner current="true" primary="true">Microsoft</owner>
6 //------------------------------------------------------------------------------
8 namespace System
.Xml
.Xsl
.XsltOld
{
9 using Res
= System
.Xml
.Utils
.Res
;
11 using System
.Diagnostics
;
13 using System
.Xml
.XPath
;
15 internal class NamespaceEvent
: Event
{
16 private string namespaceUri
;
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
) {
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
);