Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / CopyAction.cs / 1 / 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 (Keywords.Equals(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 (Keywords.Equals(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
- SchemaObjectWriter.cs
- EventProperty.cs
- handlecollector.cs
- HandoffBehavior.cs
- MessageDescription.cs
- SplitterCancelEvent.cs
- EtwTrace.cs
- SplashScreenNativeMethods.cs
- FilterException.cs
- TextStore.cs
- HwndTarget.cs
- ThreadExceptionDialog.cs
- DynamicControl.cs
- DoubleAnimationUsingKeyFrames.cs
- TableItemProviderWrapper.cs
- FunctionQuery.cs
- DelayedRegex.cs
- ExpressionLink.cs
- ContextBase.cs
- SettingsPropertyCollection.cs
- BindingContext.cs
- SplineKeyFrames.cs
- SimpleWebHandlerParser.cs
- InsufficientMemoryException.cs
- DBPropSet.cs
- _AcceptOverlappedAsyncResult.cs
- InnerItemCollectionView.cs
- PolyBezierSegment.cs
- ConstNode.cs
- HtmlInputCheckBox.cs
- _NegotiateClient.cs
- DataMemberConverter.cs
- PersonalizationAdministration.cs
- FormatException.cs
- Clipboard.cs
- SQLByte.cs
- ColumnResizeAdorner.cs
- ToolStrip.cs
- XmlDesigner.cs
- Int32Converter.cs
- ReferencedCollectionType.cs
- RegexRunner.cs
- ProviderBase.cs
- GcHandle.cs
- BrowserTree.cs
- OracleConnectionString.cs
- MULTI_QI.cs
- HostedTransportConfigurationManager.cs
- WebPart.cs
- WindowsTokenRoleProvider.cs
- DependencyPropertyDescriptor.cs
- SystemIPv6InterfaceProperties.cs
- XmlStreamStore.cs
- ViewStateModeByIdAttribute.cs
- WebPartTransformerAttribute.cs
- Boolean.cs
- EntityUtil.cs
- ClientApiGenerator.cs
- SHA256Managed.cs
- Timer.cs
- NativeMethods.cs
- EventLogRecord.cs
- SafeHandle.cs
- MeasurementDCInfo.cs
- XPathNodeIterator.cs
- ResourcePart.cs
- XmlWellformedWriter.cs
- D3DImage.cs
- TypeBrowserDialog.cs
- ActivationArguments.cs
- HashSetDebugView.cs
- XmlAttributeOverrides.cs
- _NetworkingPerfCounters.cs
- InstanceKey.cs
- GeneralTransform.cs
- Tokenizer.cs
- ResolveMatchesCD1.cs
- XmlImplementation.cs
- ConfigsHelper.cs
- DataGridAddNewRow.cs
- HMACSHA256.cs
- SoapSchemaImporter.cs
- WriteableBitmap.cs
- RewritingProcessor.cs
- WebColorConverter.cs
- SelectingProviderEventArgs.cs
- SelectedDatesCollection.cs
- PageRanges.cs
- WhiteSpaceTrimStringConverter.cs
- ContentType.cs
- DataSourceGeneratorException.cs
- ClassGenerator.cs
- SamlSubjectStatement.cs
- RuntimeWrappedException.cs
- EmptyEnumerable.cs
- StreamingContext.cs
- Popup.cs
- DurationConverter.cs
- VirtualizedContainerService.cs
- DependencyObjectProvider.cs