Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / Runtime / XmlILIndex.cs / 1305376 / XmlILIndex.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Xml.XPath; namespace System.Xml.Xsl.Runtime { ////// This class manages nodes from one input document, indexed by key value(s). /// [EditorBrowsable(EditorBrowsableState.Never)] public sealed class XmlILIndex { private Dictionarytable; /// /// This constructor is internal so that external users cannot construct it (and therefore we do not have to test it separately). /// internal XmlILIndex() { this.table = new Dictionary(); } /// /// Add a node indexed by the specified key value. /// public void Add(string key, XPathNavigator navigator) { XmlQueryNodeSequence seq; if (!this.table.TryGetValue(key, out seq)) { // Create a new sequence and add it to the index seq = new XmlQueryNodeSequence(); seq.AddClone(navigator); this.table.Add(key, seq); } else { // The nodes are guaranteed to be added in document order with possible duplicates. // Add node to the existing sequence if it differs from the last one. Debug.Assert(navigator.ComparePosition(seq[seq.Count - 1]) >= 0, "Index nodes must be added in document order"); if (!navigator.IsSamePosition(seq[seq.Count - 1])) { seq.AddClone(navigator); } } } ////// Lookup a sequence of nodes that are indexed by the specified key value. /// Return a non-null empty sequence, if there are no nodes associated with the key. /// public XmlQueryNodeSequence Lookup(string key) { XmlQueryNodeSequence seq; if (!this.table.TryGetValue(key, out seq)) seq = new XmlQueryNodeSequence(); return seq; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Xml.XPath; namespace System.Xml.Xsl.Runtime { ////// This class manages nodes from one input document, indexed by key value(s). /// [EditorBrowsable(EditorBrowsableState.Never)] public sealed class XmlILIndex { private Dictionarytable; /// /// This constructor is internal so that external users cannot construct it (and therefore we do not have to test it separately). /// internal XmlILIndex() { this.table = new Dictionary(); } /// /// Add a node indexed by the specified key value. /// public void Add(string key, XPathNavigator navigator) { XmlQueryNodeSequence seq; if (!this.table.TryGetValue(key, out seq)) { // Create a new sequence and add it to the index seq = new XmlQueryNodeSequence(); seq.AddClone(navigator); this.table.Add(key, seq); } else { // The nodes are guaranteed to be added in document order with possible duplicates. // Add node to the existing sequence if it differs from the last one. Debug.Assert(navigator.ComparePosition(seq[seq.Count - 1]) >= 0, "Index nodes must be added in document order"); if (!navigator.IsSamePosition(seq[seq.Count - 1])) { seq.AddClone(navigator); } } } ////// Lookup a sequence of nodes that are indexed by the specified key value. /// Return a non-null empty sequence, if there are no nodes associated with the key. /// public XmlQueryNodeSequence Lookup(string key) { XmlQueryNodeSequence seq; if (!this.table.TryGetValue(key, out seq)) seq = new XmlQueryNodeSequence(); return seq; } } } // 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
- EventManager.cs
- StringFreezingAttribute.cs
- PolicyManager.cs
- FragmentQueryProcessor.cs
- CodeConstructor.cs
- InheritanceContextChangedEventManager.cs
- DrawListViewItemEventArgs.cs
- SerializationFieldInfo.cs
- DoubleConverter.cs
- ResourceSet.cs
- ModulesEntry.cs
- UnsafeNativeMethods.cs
- DataGridViewAutoSizeModeEventArgs.cs
- UIElementPropertyUndoUnit.cs
- ConfigurationException.cs
- PerfService.cs
- PolygonHotSpot.cs
- OledbConnectionStringbuilder.cs
- PerformanceCounterCategory.cs
- ValidatorCompatibilityHelper.cs
- PrefixHandle.cs
- IndexExpression.cs
- DesignerDataConnection.cs
- CryptoHandle.cs
- ScopeCompiler.cs
- PresentationSource.cs
- EventData.cs
- CompressedStack.cs
- FileUtil.cs
- TableParagraph.cs
- AnnotationResourceCollection.cs
- XmlSchemaInfo.cs
- ProviderMetadata.cs
- DataObject.cs
- XmlBinaryReader.cs
- ProfileGroupSettings.cs
- PixelFormatConverter.cs
- UriParserTemplates.cs
- SqlProfileProvider.cs
- QueryCreatedEventArgs.cs
- Page.cs
- SqlHelper.cs
- CharUnicodeInfo.cs
- OrderByExpression.cs
- compensatingcollection.cs
- EventWaitHandle.cs
- ProxyHwnd.cs
- Stacktrace.cs
- AssemblyInfo.cs
- DocumentViewer.cs
- AsymmetricCryptoHandle.cs
- RadioButtonStandardAdapter.cs
- CodeParameterDeclarationExpression.cs
- BaseTemplatedMobileComponentEditor.cs
- PageClientProxyGenerator.cs
- AssemblyNameProxy.cs
- WebPartAuthorizationEventArgs.cs
- GcHandle.cs
- EncodedStreamFactory.cs
- ScriptingProfileServiceSection.cs
- CachedFontFamily.cs
- SecurityStateEncoder.cs
- StatusBar.cs
- FormViewCommandEventArgs.cs
- TextSpan.cs
- TrustManagerPromptUI.cs
- BitVec.cs
- ConfigurationLocationCollection.cs
- FileEnumerator.cs
- XmlArrayItemAttributes.cs
- LiteralText.cs
- XmlDataProvider.cs
- SemaphoreSecurity.cs
- TableStyle.cs
- ContainerUIElement3D.cs
- EditCommandColumn.cs
- HttpServerUtilityBase.cs
- SqlMetaData.cs
- DefaultAsyncDataDispatcher.cs
- ExpressionPrinter.cs
- LocalizabilityAttribute.cs
- FixedPageAutomationPeer.cs
- WindowsTokenRoleProvider.cs
- ParseNumbers.cs
- BuildManager.cs
- GCHandleCookieTable.cs
- ObjectDataSourceChooseTypePanel.cs
- ListViewHitTestInfo.cs
- codemethodreferenceexpression.cs
- PointValueSerializer.cs
- ImmutableObjectAttribute.cs
- rsa.cs
- GridViewColumnHeader.cs
- TypeSystem.cs
- FrameworkElement.cs
- DragEvent.cs
- SectionRecord.cs
- LinkConverter.cs
- PropertySegmentSerializationProvider.cs
- RegexMatch.cs