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 / 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
- RegisteredScript.cs
- MatrixKeyFrameCollection.cs
- ReflectionPermission.cs
- GeneralTransformCollection.cs
- MD5CryptoServiceProvider.cs
- SettingsAttributeDictionary.cs
- TargetConverter.cs
- ButtonBaseDesigner.cs
- StoreContentChangedEventArgs.cs
- LogicalCallContext.cs
- LoginNameDesigner.cs
- DataObjectSettingDataEventArgs.cs
- SessionPageStateSection.cs
- Vector3DCollectionConverter.cs
- InternalConfigSettingsFactory.cs
- PagesSection.cs
- TextBoxBase.cs
- FixedSOMFixedBlock.cs
- StreamInfo.cs
- ipaddressinformationcollection.cs
- XmlSerializableReader.cs
- SqlBuilder.cs
- XmlDataLoader.cs
- PropertyPathConverter.cs
- Debugger.cs
- XsltContext.cs
- CompositeCollectionView.cs
- OleDbPermission.cs
- WmlListAdapter.cs
- TypeConvertions.cs
- SessionIDManager.cs
- GridItemProviderWrapper.cs
- ReadOnlyNameValueCollection.cs
- HotCommands.cs
- XmlSchemaExporter.cs
- GlyphElement.cs
- SearchForVirtualItemEventArgs.cs
- ListenerElementsCollection.cs
- DictionaryTraceRecord.cs
- WriteableBitmap.cs
- QilName.cs
- PropertyGeneratedEventArgs.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- QuotedPrintableStream.cs
- HttpListenerResponse.cs
- EditorZoneDesigner.cs
- _Rfc2616CacheValidators.cs
- EventDriven.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- AppearanceEditorPart.cs
- ConstNode.cs
- WebServicesSection.cs
- XmlSortKeyAccumulator.cs
- UpDownBaseDesigner.cs
- MasterPageBuildProvider.cs
- XmlSchemaChoice.cs
- BuiltInPermissionSets.cs
- PrintSchema.cs
- PrintPreviewDialog.cs
- IERequestCache.cs
- LabelDesigner.cs
- DataGridHeaderBorder.cs
- XmlTextReaderImplHelpers.cs
- PeerNameResolver.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- NamespaceDecl.cs
- ContentOperations.cs
- DrawingVisualDrawingContext.cs
- TraceListeners.cs
- ExceptionRoutedEventArgs.cs
- TextCharacters.cs
- DataObjectCopyingEventArgs.cs
- ErrorStyle.cs
- AccessDataSourceWizardForm.cs
- TypeToken.cs
- StringComparer.cs
- PasswordBox.cs
- GridViewDeleteEventArgs.cs
- DBSchemaTable.cs
- DataException.cs
- PrivilegedConfigurationManager.cs
- XsltArgumentList.cs
- ApplicationFileParser.cs
- PrinterSettings.cs
- Speller.cs
- LowerCaseStringConverter.cs
- OutputCacheSection.cs
- BridgeDataRecord.cs
- SortDescription.cs
- Metadata.cs
- assertwrapper.cs
- NativeCppClassAttribute.cs
- EpmCustomContentWriterNodeData.cs
- ListViewDataItem.cs
- RecordConverter.cs
- PathFigureCollection.cs
- DataGridViewRowsAddedEventArgs.cs
- StreamGeometryContext.cs
- Mapping.cs
- EntityDataSourceDataSelectionPanel.cs