Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- TreeViewItemAutomationPeer.cs
- ManifestSignatureInformation.cs
- AuthenticationModulesSection.cs
- FormsAuthenticationModule.cs
- ScrollProviderWrapper.cs
- LeftCellWrapper.cs
- ContextMenuStrip.cs
- ClientSession.cs
- PageVisual.cs
- QueryExpr.cs
- RegistryExceptionHelper.cs
- WebBrowserUriTypeConverter.cs
- AssemblyName.cs
- Rotation3D.cs
- Size.cs
- OpacityConverter.cs
- RichTextBox.cs
- WasHttpModulesInstallComponent.cs
- GC.cs
- HtmlHistory.cs
- WebPartCatalogAddVerb.cs
- MeasurementDCInfo.cs
- SecurityTokenSerializer.cs
- CutCopyPasteHelper.cs
- CodeGenerator.cs
- SingleAnimationUsingKeyFrames.cs
- X509CertificateCollection.cs
- XsltArgumentList.cs
- LayoutTable.cs
- RuntimeResourceSet.cs
- DetailsViewUpdateEventArgs.cs
- LineUtil.cs
- KeyValueSerializer.cs
- PopupRoot.cs
- SapiRecoContext.cs
- TextProviderWrapper.cs
- PDBReader.cs
- RegularExpressionValidator.cs
- Propagator.cs
- MessageSecurityOverTcp.cs
- MSHTMLHost.cs
- LinearQuaternionKeyFrame.cs
- XMLSyntaxException.cs
- XmlCodeExporter.cs
- StorageConditionPropertyMapping.cs
- ObjectDisposedException.cs
- XmlUnspecifiedAttribute.cs
- IApplicationTrustManager.cs
- filewebrequest.cs
- ViewPort3D.cs
- FillRuleValidation.cs
- RelationalExpressions.cs
- ContractUtils.cs
- _LazyAsyncResult.cs
- XpsSerializationException.cs
- ServiceOperationHelpers.cs
- ProcessModelSection.cs
- CLSCompliantAttribute.cs
- ErrorTableItemStyle.cs
- CultureSpecificStringDictionary.cs
- SerializationEventsCache.cs
- validation.cs
- EventManager.cs
- ListViewTableCell.cs
- BackgroundWorker.cs
- SoapElementAttribute.cs
- WindowsToolbarAsMenu.cs
- UtilityExtension.cs
- WhitespaceRuleLookup.cs
- WebConfigurationHostFileChange.cs
- UpdateDelegates.Generated.cs
- TypeElement.cs
- FullTextLine.cs
- StateBag.cs
- MonikerUtility.cs
- TabletDeviceInfo.cs
- ResourcesGenerator.cs
- DataSourceGeneratorException.cs
- BindableAttribute.cs
- DecoderFallback.cs
- X509AsymmetricSecurityKey.cs
- URI.cs
- PassportIdentity.cs
- RectValueSerializer.cs
- FontClient.cs
- FontUnit.cs
- AdCreatedEventArgs.cs
- SizeLimitedCache.cs
- SmtpException.cs
- UserControlDocumentDesigner.cs
- SaveFileDialogDesigner.cs
- ContextMarshalException.cs
- DotExpr.cs
- SessionStateModule.cs
- BooleanProjectedSlot.cs
- ItemAutomationPeer.cs
- RichTextBoxDesigner.cs
- UxThemeWrapper.cs
- NavigationWindowAutomationPeer.cs
- AsyncSerializedWorker.cs