Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / XmlUtils / System / Xml / Xsl / Runtime / XmlILIndex.cs / 2 / 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
- RectangleConverter.cs
- Image.cs
- FontWeightConverter.cs
- _DigestClient.cs
- IPHostEntry.cs
- XmlSchemaSimpleContent.cs
- AsynchronousChannelMergeEnumerator.cs
- RelationshipNavigation.cs
- IssuerInformation.cs
- ActiveXSite.cs
- HwndAppCommandInputProvider.cs
- SpecialFolderEnumConverter.cs
- DelegateHelpers.cs
- CommandBinding.cs
- StylusButton.cs
- WindowsGraphics2.cs
- AccessDataSource.cs
- BaseTemplateBuildProvider.cs
- CompilerErrorCollection.cs
- MachineKeyConverter.cs
- DataGridViewCellCancelEventArgs.cs
- CapabilitiesUse.cs
- UnicastIPAddressInformationCollection.cs
- ToolBarButton.cs
- UriTemplateQueryValue.cs
- _NegoState.cs
- UIElementParaClient.cs
- RuntimeTrackingProfile.cs
- FillErrorEventArgs.cs
- SectionInformation.cs
- Rectangle.cs
- ReadOnlyHierarchicalDataSourceView.cs
- LinqDataSourceSelectEventArgs.cs
- DataConnectionHelper.cs
- ApplicationException.cs
- ListMarkerSourceInfo.cs
- Nullable.cs
- ContextMenu.cs
- XmlSchemaSubstitutionGroup.cs
- SimpleWebHandlerParser.cs
- ItemsPresenter.cs
- MetabaseReader.cs
- HtmlInputFile.cs
- SystemEvents.cs
- SoapTypeAttribute.cs
- ToolStripPanel.cs
- CodeVariableReferenceExpression.cs
- CacheOutputQuery.cs
- EntityCommand.cs
- SubpageParagraph.cs
- Script.cs
- ApplicationServiceManager.cs
- MetabaseServerConfig.cs
- Vector3DAnimation.cs
- MimeMapping.cs
- KeyFrames.cs
- ChtmlCalendarAdapter.cs
- TextEditorMouse.cs
- MailAddressParser.cs
- TrustLevelCollection.cs
- IPAddress.cs
- Scheduler.cs
- ManagementExtension.cs
- ScrollChrome.cs
- Assert.cs
- BitmapEncoder.cs
- PolyBezierSegment.cs
- AutomationPattern.cs
- Light.cs
- ServiceHttpHandlerFactory.cs
- UIElementIsland.cs
- EmptyEnumerator.cs
- TableLayoutSettingsTypeConverter.cs
- BooleanToVisibilityConverter.cs
- ObjectDataSourceEventArgs.cs
- SqlDependency.cs
- CreateUserWizard.cs
- MonikerHelper.cs
- base64Transforms.cs
- ReceiveSecurityHeaderEntry.cs
- TextServicesPropertyRanges.cs
- SqlBuffer.cs
- ConnectionStringSettingsCollection.cs
- ChangePasswordDesigner.cs
- SplayTreeNode.cs
- TimelineCollection.cs
- BridgeDataRecord.cs
- SponsorHelper.cs
- DataBinding.cs
- DtdParser.cs
- ellipse.cs
- IisTraceListener.cs
- Underline.cs
- ToolTip.cs
- StringToken.cs
- DummyDataSource.cs
- SafeBitVector32.cs
- RSAPKCS1SignatureFormatter.cs
- DelegateHelpers.Generated.cs
- EditorPart.cs