Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / XsltOld / ValueOfAction.cs / 1305376 / ValueOfAction.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; internal class ValueOfAction : CompiledAction { private const int ResultStored = 2; private int selectKey = Compiler.InvalidQueryKey; private bool disableOutputEscaping; private static Action s_BuiltInRule = new BuiltInRuleTextAction(); internal static Action BuiltInRule() { Debug.Assert(s_BuiltInRule != null); return s_BuiltInRule; } 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 if (Ref.Equal(name, compiler.Atoms.DisableOutputEscaping)) { this.disableOutputEscaping = compiler.GetYesNo(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 != null); Debug.Assert(frame.NodeSet != null); string value = processor.ValueOf(frame, this.selectKey); if (processor.TextEvent(value, disableOutputEscaping)) { frame.Finished(); } else { frame.StoredOutput = value; frame.State = ResultStored; } break; case ResultStored: Debug.Assert(frame.StoredOutput != null); processor.TextEvent(frame.StoredOutput); frame.Finished(); break; default: Debug.Fail("Invalid ValueOfAction execution state"); break; } } } internal class BuiltInRuleTextAction : Action { private const int ResultStored = 2; internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: Debug.Assert(frame != null); Debug.Assert(frame.NodeSet != null); string value = processor.ValueOf(frame.NodeSet.Current); if (processor.TextEvent(value, /*disableOutputEscaping:*/false)) { frame.Finished(); } else { frame.StoredOutput = value; frame.State = ResultStored; } break; case ResultStored: Debug.Assert(frame.StoredOutput != null); processor.TextEvent(frame.StoredOutput); frame.Finished(); break; default: Debug.Fail("Invalid BuiltInRuleTextAction execution state"); 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; internal class ValueOfAction : CompiledAction { private const int ResultStored = 2; private int selectKey = Compiler.InvalidQueryKey; private bool disableOutputEscaping; private static Action s_BuiltInRule = new BuiltInRuleTextAction(); internal static Action BuiltInRule() { Debug.Assert(s_BuiltInRule != null); return s_BuiltInRule; } 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 if (Ref.Equal(name, compiler.Atoms.DisableOutputEscaping)) { this.disableOutputEscaping = compiler.GetYesNo(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 != null); Debug.Assert(frame.NodeSet != null); string value = processor.ValueOf(frame, this.selectKey); if (processor.TextEvent(value, disableOutputEscaping)) { frame.Finished(); } else { frame.StoredOutput = value; frame.State = ResultStored; } break; case ResultStored: Debug.Assert(frame.StoredOutput != null); processor.TextEvent(frame.StoredOutput); frame.Finished(); break; default: Debug.Fail("Invalid ValueOfAction execution state"); break; } } } internal class BuiltInRuleTextAction : Action { private const int ResultStored = 2; internal override void Execute(Processor processor, ActionFrame frame) { Debug.Assert(processor != null && frame != null); switch (frame.State) { case Initialized: Debug.Assert(frame != null); Debug.Assert(frame.NodeSet != null); string value = processor.ValueOf(frame.NodeSet.Current); if (processor.TextEvent(value, /*disableOutputEscaping:*/false)) { frame.Finished(); } else { frame.StoredOutput = value; frame.State = ResultStored; } break; case ResultStored: Debug.Assert(frame.StoredOutput != null); processor.TextEvent(frame.StoredOutput); frame.Finished(); break; default: Debug.Fail("Invalid BuiltInRuleTextAction execution state"); 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
- NonVisualControlAttribute.cs
- AccessKeyManager.cs
- BaseDataBoundControl.cs
- DataObjectFieldAttribute.cs
- COM2IVsPerPropertyBrowsingHandler.cs
- SpeechEvent.cs
- PrimarySelectionGlyph.cs
- FrameworkContentElementAutomationPeer.cs
- ImageFormatConverter.cs
- PreservationFileReader.cs
- Flattener.cs
- LinkUtilities.cs
- ButtonStandardAdapter.cs
- TypeInitializationException.cs
- Document.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- BamlReader.cs
- ReferenceSchema.cs
- AssemblyResourceLoader.cs
- PauseStoryboard.cs
- XmlNodeChangedEventArgs.cs
- BindMarkupExtensionSerializer.cs
- DrawingServices.cs
- DbParameterHelper.cs
- DataGridParentRows.cs
- FileDialogPermission.cs
- SuppressIldasmAttribute.cs
- DecimalConstantAttribute.cs
- QueueTransferProtocol.cs
- CaseExpr.cs
- TextServicesHost.cs
- Literal.cs
- ActivationServices.cs
- WorkflowPageSetupDialog.cs
- XmlSubtreeReader.cs
- CompositeControl.cs
- ResourceExpression.cs
- XmlDataCollection.cs
- Type.cs
- ISAPIWorkerRequest.cs
- CompiledQuery.cs
- OleServicesContext.cs
- NameTable.cs
- ExpressionContext.cs
- SafeRegistryHandle.cs
- RequestCachePolicyConverter.cs
- XmlSchema.cs
- ComponentDispatcherThread.cs
- AutoGeneratedFieldProperties.cs
- SerializerDescriptor.cs
- TraceListener.cs
- XPathExpr.cs
- SchemaElementLookUpTable.cs
- MulticastNotSupportedException.cs
- SafeFileMapViewHandle.cs
- LinqDataSource.cs
- ImageButton.cs
- XXXOnTypeBuilderInstantiation.cs
- EmptyQuery.cs
- HttpPostServerProtocol.cs
- BitmapEffectGeneralTransform.cs
- EmptyEnumerable.cs
- VirtualPath.cs
- ViewManager.cs
- filewebresponse.cs
- JsonCollectionDataContract.cs
- KeyProperty.cs
- HyperLinkField.cs
- Group.cs
- WorkflowLayouts.cs
- ToolStripDesignerUtils.cs
- WriteFileContext.cs
- XmlNamespaceDeclarationsAttribute.cs
- UrlPath.cs
- HttpClientCertificate.cs
- HostExecutionContextManager.cs
- PingReply.cs
- ProjectedSlot.cs
- Queue.cs
- TypeLibConverter.cs
- SemaphoreSecurity.cs
- RightsDocument.cs
- TraceContextEventArgs.cs
- TextSerializer.cs
- WindowsStatic.cs
- SingleObjectCollection.cs
- Visual3D.cs
- PointLight.cs
- DataServiceRequest.cs
- GroupedContextMenuStrip.cs
- WebPartConnectionsCloseVerb.cs
- LinqToSqlWrapper.cs
- GregorianCalendarHelper.cs
- TraceInternal.cs
- Rfc4050KeyFormatter.cs
- RemotingAttributes.cs
- SystemInfo.cs
- OleDbTransaction.cs
- HttpDictionary.cs
- OutputCacheSettingsSection.cs