Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / CopyOfAction.cs / 1305376 / CopyOfAction.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 CopyOfAction : CompiledAction { private const int ResultStored = 2; private const int NodeSetCopied = 3; private int selectKey = Compiler.InvalidQueryKey; internal override void Compile(Compiler compiler) { CompileAttributes(compiler); CheckRequiredAttribute(compiler, selectKey != Compiler.InvalidQueryKey, "select"); CheckEmpty(compiler); } internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Select)) { this.selectKey = compiler.AddQuery(value); } else { return false; } return true; } internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: Debug.Assert(frame.NodeSet != null); Query query = processor.GetValueQuery(this.selectKey); object result = query.Evaluate(frame.NodeSet); if (result is XPathNodeIterator) { // we cash this query because otherwise current() works incorrectly. Bug#382166. // To be perfect we should use frame.NewNodeSet here processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathArrayIterator(query)); frame.State = NodeSetCopied; break; } XPathNavigator nav = result as XPathNavigator; if (nav != null) { processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathSingletonIterator(nav)); frame.State = NodeSetCopied; break; } string value = XmlConvert.ToXPathString(result); if (processor.TextEvent(value)) { frame.Finished(); } else { frame.StoredOutput = value; frame.State = ResultStored; } break; case ResultStored: Debug.Assert(frame.StoredOutput != null); processor.TextEvent(frame.StoredOutput); frame.Finished(); break; case NodeSetCopied: Debug.Assert(frame.State == NodeSetCopied); frame.Finished(); 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 CopyOfAction : CompiledAction { private const int ResultStored = 2; private const int NodeSetCopied = 3; private int selectKey = Compiler.InvalidQueryKey; internal override void Compile(Compiler compiler) { CompileAttributes(compiler); CheckRequiredAttribute(compiler, selectKey != Compiler.InvalidQueryKey, "select"); CheckEmpty(compiler); } internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Ref.Equal(name, compiler.Atoms.Select)) { this.selectKey = compiler.AddQuery(value); } else { return false; } return true; } internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: Debug.Assert(frame.NodeSet != null); Query query = processor.GetValueQuery(this.selectKey); object result = query.Evaluate(frame.NodeSet); if (result is XPathNodeIterator) { // we cash this query because otherwise current() works incorrectly. Bug#382166. // To be perfect we should use frame.NewNodeSet here processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathArrayIterator(query)); frame.State = NodeSetCopied; break; } XPathNavigator nav = result as XPathNavigator; if (nav != null) { processor.PushActionFrame(CopyNodeSetAction.GetAction(), new XPathSingletonIterator(nav)); frame.State = NodeSetCopied; break; } string value = XmlConvert.ToXPathString(result); if (processor.TextEvent(value)) { frame.Finished(); } else { frame.StoredOutput = value; frame.State = ResultStored; } break; case ResultStored: Debug.Assert(frame.StoredOutput != null); processor.TextEvent(frame.StoredOutput); frame.Finished(); break; case NodeSetCopied: Debug.Assert(frame.State == NodeSetCopied); frame.Finished(); break; } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ConditionBrowserDialog.cs
- UserControlParser.cs
- TraceSwitch.cs
- TreeNodeBindingCollection.cs
- ZipIOExtraField.cs
- PolyBezierSegment.cs
- ScriptingWebServicesSectionGroup.cs
- RepeaterItemCollection.cs
- Utility.cs
- RulePatternOps.cs
- ICspAsymmetricAlgorithm.cs
- CompensatableTransactionScopeActivityDesigner.cs
- SmtpDigestAuthenticationModule.cs
- ContextMenuService.cs
- HttpCachePolicyWrapper.cs
- BuilderElements.cs
- WebFaultClientMessageInspector.cs
- XmlUrlResolver.cs
- BitmapSource.cs
- DrawingGroup.cs
- DataGridViewCellConverter.cs
- StringUtil.cs
- XomlCompilerResults.cs
- ObjectDesignerDataSourceView.cs
- Icon.cs
- ErrorFormatterPage.cs
- TransactionFilter.cs
- httpapplicationstate.cs
- HttpDebugHandler.cs
- SqlCachedBuffer.cs
- ManipulationDelta.cs
- StateChangeEvent.cs
- XmlMtomWriter.cs
- WindowsTreeView.cs
- GridViewRowPresenterBase.cs
- Vector.cs
- NamedPipeAppDomainProtocolHandler.cs
- Cursor.cs
- TabPage.cs
- XmlMemberMapping.cs
- DataGridViewCellValueEventArgs.cs
- Visual3DCollection.cs
- GraphicsPathIterator.cs
- Page.cs
- ListViewGroupCollectionEditor.cs
- RegexNode.cs
- Panel.cs
- HttpListenerContext.cs
- iisPickupDirectory.cs
- MetadataElement.cs
- ElementInit.cs
- JsonXmlDataContract.cs
- EnumerableRowCollectionExtensions.cs
- Internal.cs
- ProfileInfo.cs
- XmlNotation.cs
- PartialTrustHelpers.cs
- WmlMobileTextWriter.cs
- ACE.cs
- LightweightCodeGenerator.cs
- FixedNode.cs
- StandardOleMarshalObject.cs
- XmlSchemaChoice.cs
- TemplatedControlDesigner.cs
- ShaderRenderModeValidation.cs
- Int16AnimationBase.cs
- InstancePersistence.cs
- Repeater.cs
- AutoResetEvent.cs
- XsltQilFactory.cs
- RegexGroup.cs
- JoinSymbol.cs
- OleDbCommand.cs
- OutputCacheProfile.cs
- LineBreak.cs
- CollectionViewGroupRoot.cs
- ClientBuildManager.cs
- XmlNodeComparer.cs
- SqlDataSourceFilteringEventArgs.cs
- WebUtil.cs
- ResourceDescriptionAttribute.cs
- SvcMapFileSerializer.cs
- ProvidePropertyAttribute.cs
- InputBuffer.cs
- SchemaHelper.cs
- ListViewGroupItemCollection.cs
- InvokeHandlers.cs
- WindowsTokenRoleProvider.cs
- DataSourceCacheDurationConverter.cs
- SystemPens.cs
- COM2ComponentEditor.cs
- DetailsViewDeleteEventArgs.cs
- ControlDesigner.cs
- TemplateInstanceAttribute.cs
- EntityDataSourceView.cs
- HandledMouseEvent.cs
- XmlException.cs
- Event.cs
- EventSinkHelperWriter.cs
- UserValidatedEventArgs.cs