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

  1. //------------------------------------------------------------------------------
  2. // <copyright file="CommentAction.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.     using System.Xml.XPath;
  22.    
  23.     internal class CommentAction : ContainerAction
  24.     {
  25.         internal override void Compile(Compiler compiler)
  26.         {
  27.             CompileAttributes(compiler);
  28.            
  29.             if (compiler.Recurse()) {
  30.                 CompileTemplate(compiler);
  31.                 compiler.ToParent();
  32.             }
  33.         }
  34.        
  35.         internal override void Execute(Processor processor, ActionFrame frame)
  36.         {
  37.             Debug.Assert(processor != null && frame != null);
  38.            
  39.             switch (frame.State) {
  40.                 case Initialized:
  41.                     if (processor.BeginEvent(XPathNodeType.Comment, string.Empty, string.Empty, string.Empty, false) == false) {
  42.                         // Come back later
  43.                         break;
  44.                     }
  45.                    
  46.                     processor.PushActionFrame(frame);
  47.                     frame.State = ProcessingChildren;
  48.                     break;
  49.                 case ProcessingChildren:
  50.                     // Allow children to run
  51.                     if (processor.EndEvent(XPathNodeType.Comment) == false) {
  52.                         break;
  53.                     }
  54.                    
  55.                     frame.Finished();
  56.                     break;
  57.                 default:
  58.                    
  59.                     Debug.Fail("Invalid IfAction execution state");
  60.                     break;
  61.             }
  62.         }
  63.     }
  64. }

Developer Fusion