Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / CopyOfAction.cs / 1 / 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, Keywords.s_Select); CheckEmpty(compiler); } internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(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, Keywords.s_Select); CheckEmpty(compiler); } internal override bool CompileAttribute(Compiler compiler) { string name = compiler.Input.LocalName; string value = compiler.Input.Value; if (Keywords.Equals(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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TypeDependencyAttribute.cs
- WorkflowInstanceExtensionCollection.cs
- AuthorizationSection.cs
- TransportContext.cs
- StringResourceManager.cs
- DataGridViewRowsRemovedEventArgs.cs
- PeerInvitationResponse.cs
- StylusPointPropertyInfo.cs
- ToolStripRendererSwitcher.cs
- CqlParserHelpers.cs
- DataServiceException.cs
- Graphics.cs
- PreviewPageInfo.cs
- ListViewTableRow.cs
- XNameTypeConverter.cs
- Msec.cs
- rsa.cs
- DataPointer.cs
- FullTextBreakpoint.cs
- BitmapEffectInput.cs
- Int16Animation.cs
- querybuilder.cs
- ButtonColumn.cs
- FormView.cs
- InfoCardRSAOAEPKeyExchangeFormatter.cs
- Configuration.cs
- ParamArrayAttribute.cs
- OutOfMemoryException.cs
- StorageMappingFragment.cs
- PeerToPeerException.cs
- DataColumnMappingCollection.cs
- BmpBitmapDecoder.cs
- Int16AnimationUsingKeyFrames.cs
- NamespaceEmitter.cs
- AnimationException.cs
- mediaeventargs.cs
- RadioButtonStandardAdapter.cs
- AnonymousIdentificationSection.cs
- NavigateEvent.cs
- Utils.cs
- Assert.cs
- ResourceAssociationSet.cs
- LifetimeMonitor.cs
- ConfigurationManagerHelperFactory.cs
- TaiwanLunisolarCalendar.cs
- SpeechAudioFormatInfo.cs
- RepeatBehavior.cs
- PublisherIdentityPermission.cs
- Transactions.cs
- CompositeFontFamily.cs
- uribuilder.cs
- WindowsNonControl.cs
- ConfigurationFileMap.cs
- MenuItemStyle.cs
- StylusTip.cs
- FontFamilyValueSerializer.cs
- AuthenticationModuleElement.cs
- FileUtil.cs
- DataPointer.cs
- CancelEventArgs.cs
- SiteMapDataSource.cs
- CodeDOMUtility.cs
- ErrorInfoXmlDocument.cs
- IndexerNameAttribute.cs
- EdmSchemaError.cs
- Types.cs
- InstanceLockedException.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- BStrWrapper.cs
- ManagementQuery.cs
- ContentPlaceHolderDesigner.cs
- SqlMethodAttribute.cs
- Bold.cs
- SqlInternalConnectionTds.cs
- CopyEncoder.cs
- Control.cs
- StackOverflowException.cs
- UIPropertyMetadata.cs
- ClockGroup.cs
- CodeEventReferenceExpression.cs
- Win32KeyboardDevice.cs
- RequestStatusBarUpdateEventArgs.cs
- ContextMenuStrip.cs
- DataGridItem.cs
- FilteredReadOnlyMetadataCollection.cs
- TriggerCollection.cs
- SHA256Cng.cs
- RowCache.cs
- CipherData.cs
- CheckBox.cs
- RepeaterDataBoundAdapter.cs
- EastAsianLunisolarCalendar.cs
- RelationshipEndCollection.cs
- InstanceContextManager.cs
- EmptyEnumerator.cs
- XsdValidatingReader.cs
- AcceleratedTokenProvider.cs
- FontCollection.cs
- ObjectDataSourceSelectingEventArgs.cs
- UInt16Converter.cs