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 / 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
- ConfigurationSection.cs
- SubstitutionList.cs
- StylusPlugin.cs
- PersonalizationEntry.cs
- InvalidateEvent.cs
- UxThemeWrapper.cs
- CorruptingExceptionCommon.cs
- RichTextBoxConstants.cs
- DeflateStream.cs
- EntitySetDataBindingList.cs
- ITextView.cs
- CodeMemberProperty.cs
- CustomAttributeBuilder.cs
- COM2AboutBoxPropertyDescriptor.cs
- CancellationState.cs
- RenderTargetBitmap.cs
- ParameterElement.cs
- IdleTimeoutMonitor.cs
- SelectorAutomationPeer.cs
- StoragePropertyMapping.cs
- Command.cs
- DataSourceSelectArguments.cs
- EventBindingService.cs
- LineUtil.cs
- PaperSource.cs
- PointF.cs
- EntityDataSourceEntityTypeFilterItem.cs
- FilterElement.cs
- IsolatedStoragePermission.cs
- DBDataPermissionAttribute.cs
- _FtpDataStream.cs
- ReadOnlyHierarchicalDataSource.cs
- RenderContext.cs
- RequestCacheValidator.cs
- Canonicalizers.cs
- XmlSchemaAttributeGroup.cs
- RecommendedAsConfigurableAttribute.cs
- X509UI.cs
- ContentControl.cs
- Splitter.cs
- DataContext.cs
- ScriptingJsonSerializationSection.cs
- StorageInfo.cs
- ThemeInfoAttribute.cs
- BufferedWebEventProvider.cs
- XmlSchemaSimpleTypeRestriction.cs
- CodeCommentStatement.cs
- APCustomTypeDescriptor.cs
- TripleDESCryptoServiceProvider.cs
- Helpers.cs
- XPathNodeInfoAtom.cs
- TypeUsage.cs
- XmlAutoDetectWriter.cs
- MetadataPropertyCollection.cs
- DesignerMetadata.cs
- ControlParameter.cs
- DrawingContextDrawingContextWalker.cs
- FrameworkElement.cs
- SqlGatherConsumedAliases.cs
- MethodAccessException.cs
- WindowInteractionStateTracker.cs
- LinkDesigner.cs
- DataGridViewBindingCompleteEventArgs.cs
- PrintEvent.cs
- AttachmentService.cs
- MediaScriptCommandRoutedEventArgs.cs
- MimeMultiPart.cs
- HierarchicalDataBoundControl.cs
- SchemaCompiler.cs
- EntityDataSourceStatementEditorForm.cs
- SQLDoubleStorage.cs
- UpdateException.cs
- PrintController.cs
- mediaeventshelper.cs
- FlagsAttribute.cs
- ToolboxDataAttribute.cs
- SmiMetaDataProperty.cs
- UInt64Storage.cs
- WrappedIUnknown.cs
- ExpressionTextBox.xaml.cs
- BamlStream.cs
- OleDbCommandBuilder.cs
- DataGridCellClipboardEventArgs.cs
- MenuItemBindingCollection.cs
- JavaScriptObjectDeserializer.cs
- ContextMenuAutomationPeer.cs
- COM2PictureConverter.cs
- XPathAxisIterator.cs
- Not.cs
- ManipulationStartedEventArgs.cs
- ParameterCollection.cs
- SafeThemeHandle.cs
- DeclarativeCatalogPart.cs
- SimpleMailWebEventProvider.cs
- SharedDp.cs
- DesignerDataView.cs
- DependencyPropertyKind.cs
- DeleteHelper.cs
- ElementAction.cs
- OutputCacheProfileCollection.cs