The Labs \ Source Viewer \ SSCLI \ System.Xml.Xsl.XsltOld \ OutputScope

  1. //------------------------------------------------------------------------------
  2. // <copyright file="OutputScope.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Xml.Xsl.XsltOld
  16. {
  17.     using Res = System.Xml.Utils.Res;
  18.     using System;
  19.     using System.Diagnostics;
  20.     using System.Xml;
  21.    
  22.     internal class OutputScope : DocumentScope
  23.     {
  24.         private string name;
  25.         private string nsUri;
  26.         private string prefix;
  27.         private XmlSpace space;
  28.         private string lang;
  29.         private bool mixed;
  30.         private bool toCData;
  31.         private HtmlElementProps htmlElementProps;
  32.         // in HTML output -- atomized name of element
  33.         internal string Name {
  34.             get { return this.name; }
  35.         }
  36.         internal string Namespace {
  37.             get { return this.nsUri; }
  38.         }
  39.         internal string Prefix {
  40.             get { return this.prefix; }
  41.             set { this.prefix = value; }
  42.         }
  43.         internal XmlSpace Space {
  44.             get { return this.space; }
  45.             set { this.space = value; }
  46.         }
  47.         internal string Lang {
  48.             get { return this.lang; }
  49.             set { this.lang = value; }
  50.         }
  51.         internal bool Mixed {
  52.             get { return this.mixed; }
  53.             set { this.mixed = value; }
  54.         }
  55.         internal bool ToCData {
  56.             get { return this.toCData; }
  57.             set { this.toCData = value; }
  58.         }
  59.         internal HtmlElementProps HtmlElementProps {
  60.             get { return this.htmlElementProps; }
  61.             set { this.htmlElementProps = value; }
  62.         }
  63.        
  64.         internal OutputScope()
  65.         {
  66.             Init(string.Empty, string.Empty, string.Empty, XmlSpace.None, string.Empty, false);
  67.         }
  68.        
  69.         internal void Init(string name, string nspace, string prefix, XmlSpace space, string lang, bool mixed)
  70.         {
  71.             this.scopes = null;
  72.             this.name = name;
  73.             this.nsUri = nspace;
  74.             this.prefix = prefix;
  75.             this.space = space;
  76.             this.lang = lang;
  77.             this.mixed = mixed;
  78.             this.toCData = false;
  79.             this.htmlElementProps = null;
  80.         }
  81.        
  82.         internal bool FindPrefix(string urn, out string prefix)
  83.         {
  84.             Debug.Assert(urn != null);
  85.            
  86.             for (NamespaceDecl scope = this.scopes; scope != null; scope = scope.Next) {
  87.                 if (Keywords.Equals(scope.Uri, urn) && scope.Prefix != null && scope.Prefix.Length > 0) {
  88.                     prefix = scope.Prefix;
  89.                     return true;
  90.                 }
  91.             }
  92.            
  93.             prefix = string.Empty;
  94.             return false;
  95.         }
  96.     }
  97. }

Developer Fusion