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 / ForEachAction.cs / 1 / ForEachAction.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.Collections; using System.Xml; using System.Xml.XPath; internal class ForEachAction : ContainerAction { private const int ProcessedSort = 2; private const int ProcessNextNode = 3; private const int PositionAdvanced = 4; private const int ContentsProcessed = 5; private int selectKey = Compiler.InvalidQueryKey; private ContainerAction sortContainer; internal override void Compile(Compiler compiler) { CompileAttributes(compiler); CheckRequiredAttribute(compiler, selectKey != Compiler.InvalidQueryKey, Keywords.s_Select); compiler.CanHaveApplyImports = false; if (compiler.Recurse()) { CompileSortElements(compiler); CompileTemplate(compiler); compiler.ToParent(); } } 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: if (sortContainer != null) { processor.InitSortArray(); processor.PushActionFrame(sortContainer, frame.NodeSet); frame.State = ProcessedSort; break; } goto case ProcessedSort; case ProcessedSort: frame.InitNewNodeSet(processor.StartQuery(frame.NodeSet, this.selectKey)); if (sortContainer != null) { Debug.Assert(processor.SortArray.Count != 0); frame.SortNewNodeSet(processor, processor.SortArray); } frame.State = ProcessNextNode; goto case ProcessNextNode; case ProcessNextNode: Debug.Assert(frame.State == ProcessNextNode); Debug.Assert(frame.NewNodeSet != null); if (frame.NewNextNode(processor)) { frame.State = PositionAdvanced; goto case PositionAdvanced; } else { frame.Finished(); break; } case PositionAdvanced: processor.PushActionFrame(frame, frame.NewNodeSet); frame.State = ContentsProcessed; break; case ContentsProcessed: frame.State = ProcessNextNode; goto case ProcessNextNode; } } protected void CompileSortElements(Compiler compiler) { NavigatorInput input = compiler.Input; do { switch(input.NodeType) { case XPathNodeType.Element: if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace) && Keywords.Equals(input.LocalName, input.Atoms.Sort)) { if (sortContainer == null) { sortContainer = new ContainerAction(); } sortContainer.AddAction(compiler.CreateSortAction()); continue; } return; case XPathNodeType.Text: return; case XPathNodeType.SignificantWhitespace: this.AddEvent(compiler.CreateTextEvent()); continue; default : continue; } } while (input.Advance()); } } } // 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.Collections; using System.Xml; using System.Xml.XPath; internal class ForEachAction : ContainerAction { private const int ProcessedSort = 2; private const int ProcessNextNode = 3; private const int PositionAdvanced = 4; private const int ContentsProcessed = 5; private int selectKey = Compiler.InvalidQueryKey; private ContainerAction sortContainer; internal override void Compile(Compiler compiler) { CompileAttributes(compiler); CheckRequiredAttribute(compiler, selectKey != Compiler.InvalidQueryKey, Keywords.s_Select); compiler.CanHaveApplyImports = false; if (compiler.Recurse()) { CompileSortElements(compiler); CompileTemplate(compiler); compiler.ToParent(); } } 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: if (sortContainer != null) { processor.InitSortArray(); processor.PushActionFrame(sortContainer, frame.NodeSet); frame.State = ProcessedSort; break; } goto case ProcessedSort; case ProcessedSort: frame.InitNewNodeSet(processor.StartQuery(frame.NodeSet, this.selectKey)); if (sortContainer != null) { Debug.Assert(processor.SortArray.Count != 0); frame.SortNewNodeSet(processor, processor.SortArray); } frame.State = ProcessNextNode; goto case ProcessNextNode; case ProcessNextNode: Debug.Assert(frame.State == ProcessNextNode); Debug.Assert(frame.NewNodeSet != null); if (frame.NewNextNode(processor)) { frame.State = PositionAdvanced; goto case PositionAdvanced; } else { frame.Finished(); break; } case PositionAdvanced: processor.PushActionFrame(frame, frame.NewNodeSet); frame.State = ContentsProcessed; break; case ContentsProcessed: frame.State = ProcessNextNode; goto case ProcessNextNode; } } protected void CompileSortElements(Compiler compiler) { NavigatorInput input = compiler.Input; do { switch(input.NodeType) { case XPathNodeType.Element: if (Keywords.Equals(input.NamespaceURI, input.Atoms.XsltNamespace) && Keywords.Equals(input.LocalName, input.Atoms.Sort)) { if (sortContainer == null) { sortContainer = new ContainerAction(); } sortContainer.AddAction(compiler.CreateSortAction()); continue; } return; case XPathNodeType.Text: return; case XPathNodeType.SignificantWhitespace: this.AddEvent(compiler.CreateTextEvent()); continue; default : continue; } } while (input.Advance()); } } } // 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
- HWStack.cs
- Point3DKeyFrameCollection.cs
- PropertyManager.cs
- SourceFileBuildProvider.cs
- Matrix3DValueSerializer.cs
- DynamicQueryableWrapper.cs
- XmlNamespaceManager.cs
- ApplicationServiceHelper.cs
- AppDomainFactory.cs
- Parameter.cs
- Stack.cs
- InkCanvasFeedbackAdorner.cs
- ProfilePropertyMetadata.cs
- WSHttpTransportSecurityElement.cs
- WindowsRichEdit.cs
- AttributeEmitter.cs
- WorkflowTransactionOptions.cs
- CheckBoxFlatAdapter.cs
- Switch.cs
- MethodBody.cs
- DispatcherSynchronizationContext.cs
- BulletChrome.cs
- SubtreeProcessor.cs
- SeekStoryboard.cs
- PropertyPathConverter.cs
- GeometryModel3D.cs
- ListBox.cs
- DoubleCollectionValueSerializer.cs
- Composition.cs
- EventProviderWriter.cs
- FeatureSupport.cs
- TcpTransportSecurity.cs
- PageAdapter.cs
- NegationPusher.cs
- HttpCookieCollection.cs
- SoapFormatter.cs
- IpcChannel.cs
- ExclusiveHandle.cs
- DetailsViewRowCollection.cs
- UnsafeNativeMethodsPenimc.cs
- _StreamFramer.cs
- DataGridViewColumnHeaderCell.cs
- Internal.cs
- SurrogateChar.cs
- AmbiguousMatchException.cs
- XmlSerializerNamespaces.cs
- PKCS1MaskGenerationMethod.cs
- InvalidateEvent.cs
- PingOptions.cs
- RuleInfoComparer.cs
- PageThemeParser.cs
- DispatcherTimer.cs
- ConfigurationManagerHelper.cs
- Stacktrace.cs
- ColorEditor.cs
- WebPartConnectionsEventArgs.cs
- SafePointer.cs
- NotifyInputEventArgs.cs
- Win32.cs
- CodeCommentStatementCollection.cs
- PreProcessor.cs
- ReferencedAssembly.cs
- XPathExpr.cs
- HttpWebRequest.cs
- TargetException.cs
- LogExtentCollection.cs
- bidPrivateBase.cs
- StorageMappingItemLoader.cs
- PopupRoot.cs
- validationstate.cs
- DesignTimeTemplateParser.cs
- QueryMath.cs
- TagMapInfo.cs
- ReturnType.cs
- MessageDecoder.cs
- ResourceDictionary.cs
- PersonalizationEntry.cs
- AppSettingsReader.cs
- ConstraintStruct.cs
- IProvider.cs
- columnmapkeybuilder.cs
- UriExt.cs
- ClientApiGenerator.cs
- DiscoveryClientBindingElement.cs
- DataSourceXmlSubItemAttribute.cs
- OleDbParameter.cs
- DiffuseMaterial.cs
- XmlDataDocument.cs
- Size.cs
- ProviderMetadataCachedInformation.cs
- ArrayConverter.cs
- TextCharacters.cs
- TCPClient.cs
- TransactionsSectionGroup.cs
- ListView.cs
- SmiRequestExecutor.cs
- PipelineModuleStepContainer.cs
- TraceContextEventArgs.cs
- BitmapDecoder.cs
- ImageSource.cs