Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- Point3DAnimation.cs
- ConditionCollection.cs
- PropertyChange.cs
- InteropBitmapSource.cs
- LeafCellTreeNode.cs
- DockAndAnchorLayout.cs
- MergeExecutor.cs
- InputManager.cs
- ResponseBodyWriter.cs
- MembershipUser.cs
- DataGridCellsPresenter.cs
- ClosureBinding.cs
- ComplexBindingPropertiesAttribute.cs
- ListControlConvertEventArgs.cs
- FlowSwitch.cs
- UIElementPropertyUndoUnit.cs
- SafeRightsManagementHandle.cs
- ToolStripLocationCancelEventArgs.cs
- SmiXetterAccessMap.cs
- HTTP_SERVICE_CONFIG_URLACL_PARAM.cs
- XmlConvert.cs
- SessionStateUtil.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- InternalResources.cs
- Span.cs
- XmlElementElement.cs
- RegexStringValidator.cs
- DefaultTextStoreTextComposition.cs
- KeyedCollection.cs
- UpdateManifestForBrowserApplication.cs
- DecimalAnimation.cs
- PartialCachingAttribute.cs
- columnmapfactory.cs
- ConfigurationSectionGroupCollection.cs
- FieldToken.cs
- ButtonFieldBase.cs
- AssemblyName.cs
- Int32Animation.cs
- PluralizationServiceUtil.cs
- ExcCanonicalXml.cs
- SessionEndingCancelEventArgs.cs
- SelectionGlyphBase.cs
- ContextMenuStripGroup.cs
- MessageEncoder.cs
- TimeoutException.cs
- CompModSwitches.cs
- RegexParser.cs
- SimpleBitVector32.cs
- TemplateComponentConnector.cs
- GradientStop.cs
- XamlReader.cs
- RemotingConfiguration.cs
- ConstraintEnumerator.cs
- AnimatedTypeHelpers.cs
- CodeCommentStatementCollection.cs
- ApplicationProxyInternal.cs
- RemotingConfigParser.cs
- TabControlDesigner.cs
- Image.cs
- GroupQuery.cs
- QuaternionRotation3D.cs
- SystemIcmpV4Statistics.cs
- MediaSystem.cs
- SafeArrayTypeMismatchException.cs
- ParseChildrenAsPropertiesAttribute.cs
- XmlSchemaGroupRef.cs
- ActivityDesigner.cs
- GACIdentityPermission.cs
- ErrorItem.cs
- counter.cs
- DataRelationCollection.cs
- FunctionMappingTranslator.cs
- Sentence.cs
- TimeSpanMinutesConverter.cs
- ComponentCommands.cs
- GeneralTransform2DTo3DTo2D.cs
- CachingParameterInspector.cs
- AuthenticationModuleElementCollection.cs
- WeakReference.cs
- DesignerSerializerAttribute.cs
- TransactionScope.cs
- WebPageTraceListener.cs
- TreeViewImageKeyConverter.cs
- DataObjectSettingDataEventArgs.cs
- Annotation.cs
- GeometryModel3D.cs
- ProviderUtil.cs
- FloaterParagraph.cs
- LabelLiteral.cs
- ViewValidator.cs
- VoiceObjectToken.cs
- HtmlTableRowCollection.cs
- TextRunCacheImp.cs
- VariantWrapper.cs
- UnsafeNativeMethods.cs
- SqlXml.cs
- BooleanProjectedSlot.cs
- MutexSecurity.cs
- FrameworkPropertyMetadata.cs
- SqlParameter.cs