Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / fx / src / XmlUtils / System / Xml / Xsl / Runtime / XmlILIndex.cs / 1 / 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
- AddressUtility.cs
- ResourcePool.cs
- Int32Converter.cs
- WeakEventManager.cs
- OleDbConnectionFactory.cs
- EntityContainer.cs
- DecoderReplacementFallback.cs
- SurrogateEncoder.cs
- QilTargetType.cs
- ISO2022Encoding.cs
- Rule.cs
- UnsafeNativeMethods.cs
- EntityViewContainer.cs
- ClientConfigurationSystem.cs
- DBCommand.cs
- SafeNativeMemoryHandle.cs
- KeyConverter.cs
- CodeParameterDeclarationExpressionCollection.cs
- QuaternionAnimation.cs
- XhtmlBasicLiteralTextAdapter.cs
- ClientBuildManagerCallback.cs
- XmlChildEnumerator.cs
- XmlFormatMapping.cs
- Win32MouseDevice.cs
- RevocationPoint.cs
- DesignBindingEditor.cs
- SafeArrayTypeMismatchException.cs
- Utilities.cs
- ToolStripDesignerAvailabilityAttribute.cs
- WebRequest.cs
- BrowserTree.cs
- SecUtil.cs
- PropertyChangeTracker.cs
- DataBindEngine.cs
- ObjectTag.cs
- UnauthorizedWebPart.cs
- HtmlSelect.cs
- HttpBindingExtension.cs
- StringInfo.cs
- ProcessInfo.cs
- QuaternionAnimation.cs
- _SafeNetHandles.cs
- ProtocolsConfigurationEntry.cs
- PointAnimationBase.cs
- ConstructorBuilder.cs
- TextServicesCompartment.cs
- ValueSerializerAttribute.cs
- ValidationResult.cs
- ToolStripDropDownItem.cs
- _HeaderInfo.cs
- HtmlHead.cs
- PrintPageEvent.cs
- CookielessHelper.cs
- PkcsMisc.cs
- HierarchicalDataSourceConverter.cs
- ASCIIEncoding.cs
- HttpCachePolicyElement.cs
- MaskDescriptors.cs
- HashStream.cs
- GetWinFXPath.cs
- TraceData.cs
- ReadOnlyMetadataCollection.cs
- Utils.cs
- TextElementAutomationPeer.cs
- ReceiveSecurityHeaderElementManager.cs
- _SslState.cs
- UTF8Encoding.cs
- SessionStateContainer.cs
- ConfigXmlComment.cs
- OleDbRowUpdatingEvent.cs
- DPAPIProtectedConfigurationProvider.cs
- ScriptBehaviorDescriptor.cs
- SpellCheck.cs
- DateTimeValueSerializerContext.cs
- KnownTypesProvider.cs
- SiteMapNodeItem.cs
- DescriptionAttribute.cs
- CodeIdentifiers.cs
- DisplayNameAttribute.cs
- HtmlInputCheckBox.cs
- UncommonField.cs
- ListViewDeleteEventArgs.cs
- BindableTemplateBuilder.cs
- ParsedRoute.cs
- Menu.cs
- UrlUtility.cs
- FusionWrap.cs
- PropertyTabAttribute.cs
- ContractHandle.cs
- SrgsElementList.cs
- WindowsListViewItemStartMenu.cs
- UnSafeCharBuffer.cs
- CommentAction.cs
- EventLogPermission.cs
- OlePropertyStructs.cs
- SafeSecurityHandles.cs
- PenCursorManager.cs
- AbsoluteQuery.cs
- PassportAuthentication.cs
- StrokeCollection2.cs