Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / CopyAction.cs / 1305376 / CopyAction.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; using System.Xml.XPath; using MS.Internal.Xml.XPath; internal class CopyAction : ContainerAction { // Local execution states private const int CopyText = 4; private const int NamespaceCopy = 5; private const int ContentsCopy = 6; private const int ProcessChildren = 7; private const int ChildrenOnly = 8; private string useAttributeSets; private bool empty; internal override void Compile(Compiler compiler) { CompileAttributes(compiler); if (compiler.Recurse()) { CompileTemplate(compiler); compiler.ToParent(); } if (this.containedActions == null) this.empty = true; } internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.UseAttributeSets)) { this.useAttributeSets = value; AddAction(compiler.CreateUseAttributeSetsAction()); } else { return false; } return true; } internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); while (processor.CanContinue) { switch (frame.State) { case Initialized: if (Processor.IsRoot(frame.Node)) { processor.PushActionFrame(frame); frame.State = ChildrenOnly; break; } if (processor.CopyBeginEvent(frame.Node, this.empty) == false) { // This event wasn't processed break; } frame.State = NamespaceCopy; continue; case NamespaceCopy: frame.State = ContentsCopy; if ( frame.Node.NodeType == XPathNodeType.Element ) { processor.PushActionFrame(CopyNamespacesAction.GetAction(), frame.NodeSet); break; } continue; case ContentsCopy: if (frame.Node.NodeType == XPathNodeType.Element && !this.empty) { //Debug.Assert(frame.Node.HasValue == false); processor.PushActionFrame(frame); frame.State = ProcessChildren; break; } else { if (processor.CopyTextEvent(frame.Node)) { frame.State = ProcessChildren; continue; } else { // This event wasn't processed break; } } case ProcessChildren: if (processor.CopyEndEvent(frame.Node)) { frame.Finished(); } break; case ChildrenOnly: frame.Finished(); break; default: Debug.Fail("Invalid CopyAction execution state"); break; } break; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml.Xsl.XsltOld { using Res = System.Xml.Utils.Res; using System; using System.Diagnostics; using System.Xml; using System.Xml.XPath; using MS.Internal.Xml.XPath; internal class CopyAction : ContainerAction { // Local execution states private const int CopyText = 4; private const int NamespaceCopy = 5; private const int ContentsCopy = 6; private const int ProcessChildren = 7; private const int ChildrenOnly = 8; private string useAttributeSets; private bool empty; internal override void Compile(Compiler compiler) { CompileAttributes(compiler); if (compiler.Recurse()) { CompileTemplate(compiler); compiler.ToParent(); } if (this.containedActions == null) this.empty = true; } internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.UseAttributeSets)) { this.useAttributeSets = value; AddAction(compiler.CreateUseAttributeSetsAction()); } else { return false; } return true; } internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); while (processor.CanContinue) { switch (frame.State) { case Initialized: if (Processor.IsRoot(frame.Node)) { processor.PushActionFrame(frame); frame.State = ChildrenOnly; break; } if (processor.CopyBeginEvent(frame.Node, this.empty) == false) { // This event wasn't processed break; } frame.State = NamespaceCopy; continue; case NamespaceCopy: frame.State = ContentsCopy; if ( frame.Node.NodeType == XPathNodeType.Element ) { processor.PushActionFrame(CopyNamespacesAction.GetAction(), frame.NodeSet); break; } continue; case ContentsCopy: if (frame.Node.NodeType == XPathNodeType.Element && !this.empty) { //Debug.Assert(frame.Node.HasValue == false); processor.PushActionFrame(frame); frame.State = ProcessChildren; break; } else { if (processor.CopyTextEvent(frame.Node)) { frame.State = ProcessChildren; continue; } else { // This event wasn't processed break; } } case ProcessChildren: if (processor.CopyEndEvent(frame.Node)) { frame.Finished(); } break; case ChildrenOnly: frame.Finished(); break; default: Debug.Fail("Invalid CopyAction execution state"); break; } break; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- BoolExpressionVisitors.cs
- ObjectStateEntryBaseUpdatableDataRecord.cs
- MarkupCompilePass1.cs
- NativeMethods.cs
- PrimaryKeyTypeConverter.cs
- TraceContextRecord.cs
- WebPartCatalogCloseVerb.cs
- DesignerView.Commands.cs
- CommandID.cs
- SequenceDesigner.cs
- IntAverageAggregationOperator.cs
- CodeIdentifiers.cs
- InternalSafeNativeMethods.cs
- SignatureToken.cs
- AtomServiceDocumentSerializer.cs
- AmbiguousMatchException.cs
- Animatable.cs
- BitmapEffectDrawing.cs
- BitmapPalettes.cs
- Double.cs
- MgmtConfigurationRecord.cs
- ToolStripItemDataObject.cs
- Receive.cs
- HtmlControl.cs
- Paragraph.cs
- ListControlConvertEventArgs.cs
- XmlUnspecifiedAttribute.cs
- CodeDOMUtility.cs
- DesignTimeTemplateParser.cs
- SignedInfo.cs
- CustomError.cs
- DropShadowEffect.cs
- PartManifestEntry.cs
- ContentHostHelper.cs
- TimelineClockCollection.cs
- ParameterReplacerVisitor.cs
- TextElementCollection.cs
- Drawing.cs
- PrintController.cs
- ExpressionVisitorHelpers.cs
- TextEffectResolver.cs
- InvokeBinder.cs
- WaitHandle.cs
- Environment.cs
- CodeCompiler.cs
- SystemColors.cs
- RecordManager.cs
- KeyInstance.cs
- XamlPathDataSerializer.cs
- ToolStripSeparatorRenderEventArgs.cs
- DoubleIndependentAnimationStorage.cs
- Authorization.cs
- InkCanvasSelection.cs
- BooleanExpr.cs
- ContextInformation.cs
- Variant.cs
- SystemGatewayIPAddressInformation.cs
- Binding.cs
- DateTimeOffsetConverter.cs
- TextParagraphCache.cs
- TranslateTransform3D.cs
- UserControlAutomationPeer.cs
- AsyncWaitHandle.cs
- GuidConverter.cs
- ServiceNotStartedException.cs
- GeometryConverter.cs
- WindowsSolidBrush.cs
- WebSysDescriptionAttribute.cs
- Group.cs
- MailDefinition.cs
- UrlPropertyAttribute.cs
- RegexTree.cs
- smtpconnection.cs
- LongValidator.cs
- SqlDelegatedTransaction.cs
- IsolatedStoragePermission.cs
- MDIClient.cs
- InvokeProviderWrapper.cs
- WindowsListViewScroll.cs
- Binding.cs
- Mapping.cs
- DataGridViewCellToolTipTextNeededEventArgs.cs
- EDesignUtil.cs
- MaxMessageSizeStream.cs
- _TimerThread.cs
- Int16Storage.cs
- PageCatalogPart.cs
- ExtendedPropertyDescriptor.cs
- StyleXamlParser.cs
- WebBrowser.cs
- XmlIncludeAttribute.cs
- Filter.cs
- ResourceAssociationSet.cs
- ScriptControlManager.cs
- ObjectResult.cs
- PriorityBinding.cs
- WindowsUserNameSecurityTokenAuthenticator.cs
- TreeNodeCollection.cs
- DispatcherObject.cs
- ThicknessAnimationBase.cs