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
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ElapsedEventArgs.cs
- indexingfiltermarshaler.cs
- DataServiceRequestOfT.cs
- SortExpressionBuilder.cs
- ZipIOExtraFieldZip64Element.cs
- PropertyReferenceSerializer.cs
- ObjectListCommand.cs
- TimeIntervalCollection.cs
- TabControlAutomationPeer.cs
- ProgressBarBrushConverter.cs
- DependencySource.cs
- BrowserTree.cs
- DesignerSelectionListAdapter.cs
- ListBoxItem.cs
- FileResponseElement.cs
- ValidatedControlConverter.cs
- ContentElement.cs
- QueryException.cs
- CacheModeConverter.cs
- Variant.cs
- IdentityModelStringsVersion1.cs
- GenericParameterDataContract.cs
- OpenTypeLayoutCache.cs
- MemberInfoSerializationHolder.cs
- XmlUtil.cs
- GridViewCancelEditEventArgs.cs
- SizeConverter.cs
- LinqDataView.cs
- HtmlInputPassword.cs
- InlineUIContainer.cs
- XmlAttributeAttribute.cs
- WebPart.cs
- QilChoice.cs
- ReadWriteSpinLock.cs
- BinarySerializer.cs
- DBSchemaTable.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- ProcessModule.cs
- DictionarySectionHandler.cs
- StylusPoint.cs
- SaveFileDialog.cs
- SqlCacheDependencySection.cs
- MemberInfoSerializationHolder.cs
- SingleKeyFrameCollection.cs
- SqlStatistics.cs
- TableCellCollection.cs
- DataGridViewCellConverter.cs
- OverrideMode.cs
- MarkupExtensionReturnTypeAttribute.cs
- DictionaryItemsCollection.cs
- QuotaExceededException.cs
- RoleGroup.cs
- XmlRootAttribute.cs
- Context.cs
- AnnotationResource.cs
- MembershipPasswordException.cs
- XslCompiledTransform.cs
- HtmlShim.cs
- EntitySet.cs
- Base64Stream.cs
- SqlStatistics.cs
- EncodingStreamWrapper.cs
- WebPartCancelEventArgs.cs
- MenuItem.cs
- CheckoutException.cs
- DefaultShape.cs
- Localizer.cs
- WebEventTraceProvider.cs
- Activation.cs
- LifetimeServices.cs
- ToolStripManager.cs
- HwndTarget.cs
- DataGridViewCellEventArgs.cs
- ConfigDefinitionUpdates.cs
- ChangeDirector.cs
- __FastResourceComparer.cs
- EasingKeyFrames.cs
- DayRenderEvent.cs
- Color.cs
- BrowserCapabilitiesCompiler.cs
- RoleManagerSection.cs
- BrowserDefinitionCollection.cs
- InheritanceAttribute.cs
- controlskin.cs
- GetWinFXPath.cs
- DesigntimeLicenseContextSerializer.cs
- OrderedDictionary.cs
- BindingExpression.cs
- FontFamily.cs
- Span.cs
- CompilerError.cs
- TreeNodeConverter.cs
- FlagsAttribute.cs
- precedingsibling.cs
- CustomAttributeBuilder.cs
- SslStream.cs
- ClientRequest.cs
- ApplicationDirectory.cs
- ProjectionRewriter.cs
- CharUnicodeInfo.cs