Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- SynchronizationHandlesCodeDomSerializer.cs
- ObjectAnimationBase.cs
- LookupNode.cs
- CrossAppDomainChannel.cs
- RC2.cs
- Stackframe.cs
- DynamicControl.cs
- RadioButtonPopupAdapter.cs
- Int32EqualityComparer.cs
- BaseComponentEditor.cs
- StateMachineWorkflow.cs
- XmlSchema.cs
- AvTraceFormat.cs
- GridLength.cs
- NodeLabelEditEvent.cs
- Activator.cs
- SqlGenericUtil.cs
- TimeSpan.cs
- TCEAdapterGenerator.cs
- CatalogZoneBase.cs
- PropertyRecord.cs
- DataGridAddNewRow.cs
- PointAnimationClockResource.cs
- UnsafeNativeMethods.cs
- DataTableMapping.cs
- DoWhileDesigner.xaml.cs
- CustomAttributeBuilder.cs
- QueueSurrogate.cs
- SoapReflector.cs
- StorageComplexPropertyMapping.cs
- LinqDataSourceValidationException.cs
- MediaTimeline.cs
- CodeIndexerExpression.cs
- ProxyElement.cs
- ExpandedProjectionNode.cs
- AnnotationAuthorChangedEventArgs.cs
- ToolStripScrollButton.cs
- XmlFormatWriterGenerator.cs
- JournalEntryStack.cs
- XsltSettings.cs
- DataSourceCache.cs
- RegexNode.cs
- TdsParser.cs
- UserPreferenceChangedEventArgs.cs
- TCPClient.cs
- Int64AnimationUsingKeyFrames.cs
- X509Certificate2Collection.cs
- VariableElement.cs
- EnumMemberAttribute.cs
- Regex.cs
- RadioButton.cs
- SqlGenerator.cs
- DataGridParentRows.cs
- FormViewDeletedEventArgs.cs
- TitleStyle.cs
- RelatedPropertyManager.cs
- RSAPKCS1SignatureDeformatter.cs
- HotSpotCollection.cs
- tooltip.cs
- PrintDialogException.cs
- BamlResourceSerializer.cs
- SqlParameter.cs
- ContainerParagraph.cs
- DynamicValueConverter.cs
- XsltFunctions.cs
- StackOverflowException.cs
- ServicePointManagerElement.cs
- ColumnMap.cs
- SqlComparer.cs
- HostProtectionPermission.cs
- ConstructorNeedsTagAttribute.cs
- BamlRecords.cs
- FileIOPermission.cs
- DrawingImage.cs
- DataViewSettingCollection.cs
- PageMediaSize.cs
- XamlSerializerUtil.cs
- SqlProviderServices.cs
- DesignBinding.cs
- UDPClient.cs
- ChangesetResponse.cs
- MetadataPropertyAttribute.cs
- ProfileBuildProvider.cs
- NativeObjectSecurity.cs
- Label.cs
- LogExtent.cs
- TextCollapsingProperties.cs
- ElementHost.cs
- ReaderWriterLockSlim.cs
- AnimatedTypeHelpers.cs
- validationstate.cs
- XmlSerializerVersionAttribute.cs
- TextRangeEdit.cs
- SymbolPair.cs
- DependencyPropertyHelper.cs
- Rect3DConverter.cs
- Formatter.cs
- COM2ComponentEditor.cs
- ProxyGenerationError.cs
- ListViewItem.cs