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 / 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
- XmlSchemaObject.cs
- EventLogEntryCollection.cs
- UpdateEventArgs.cs
- RegexTree.cs
- HMACSHA512.cs
- TypeSystemProvider.cs
- RowSpanVector.cs
- AddInContractAttribute.cs
- ElementNotAvailableException.cs
- UIElement3D.cs
- FontWeightConverter.cs
- ConfigurationLocation.cs
- OleDbTransaction.cs
- DBBindings.cs
- Transform3DGroup.cs
- METAHEADER.cs
- Dump.cs
- PersianCalendar.cs
- SqlProfileProvider.cs
- NotCondition.cs
- ReverseInheritProperty.cs
- XmlSortKeyAccumulator.cs
- StateInitialization.cs
- GridViewDeleteEventArgs.cs
- TextContainer.cs
- DesignTimeSiteMapProvider.cs
- TypeName.cs
- WebBrowser.cs
- QuarticEase.cs
- DebugView.cs
- MsmqInputChannelBase.cs
- TitleStyle.cs
- InputBuffer.cs
- DropDownButton.cs
- PasswordTextNavigator.cs
- AttributeEmitter.cs
- PkcsMisc.cs
- DbParameterCollectionHelper.cs
- CmsUtils.cs
- UnicodeEncoding.cs
- ServiceReference.cs
- HebrewCalendar.cs
- CodeAssignStatement.cs
- XPathNodeHelper.cs
- ServerIdentity.cs
- SqlClientPermission.cs
- NonParentingControl.cs
- LocalizedNameDescriptionPair.cs
- WorkflowDebuggerSteppingAttribute.cs
- ImageInfo.cs
- SqlDataAdapter.cs
- SoapSchemaImporter.cs
- RequestCacheManager.cs
- UpnEndpointIdentityExtension.cs
- HttpMethodAttribute.cs
- CodeGenHelper.cs
- SizeChangedEventArgs.cs
- Vector3DCollection.cs
- ConnectionsZone.cs
- FileDataSourceCache.cs
- ComponentCollection.cs
- GatewayIPAddressInformationCollection.cs
- FileUtil.cs
- FilteredSchemaElementLookUpTable.cs
- TypefaceMap.cs
- ScriptBehaviorDescriptor.cs
- BitmapEffectInput.cs
- IDReferencePropertyAttribute.cs
- SqlXml.cs
- WhereQueryOperator.cs
- FlowDocumentPaginator.cs
- ListenerUnsafeNativeMethods.cs
- PrintPreviewDialog.cs
- MenuItem.cs
- WebPartsPersonalization.cs
- PropVariant.cs
- StatusBarItemAutomationPeer.cs
- EntityDesignPluralizationHandler.cs
- oledbmetadatacollectionnames.cs
- DelegatedStream.cs
- OracleMonthSpan.cs
- EncodingFallbackAwareXmlTextWriter.cs
- SpAudioStreamWrapper.cs
- FormattedText.cs
- ObjectHelper.cs
- SubMenuStyleCollection.cs
- ContainerFilterService.cs
- documentation.cs
- XmlQualifiedName.cs
- SqlBuffer.cs
- SHA512CryptoServiceProvider.cs
- Component.cs
- CustomErrorsSectionWrapper.cs
- SqlClientWrapperSmiStream.cs
- FormViewInsertEventArgs.cs
- ColorTransformHelper.cs
- Trigger.cs
- XmlnsPrefixAttribute.cs
- XmlSchemaComplexContent.cs
- LabelDesigner.cs