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
- DataGridCell.cs
- OleDbConnectionFactory.cs
- Variant.cs
- Journaling.cs
- FontDriver.cs
- ResourcePart.cs
- WindowsIdentity.cs
- MarkerProperties.cs
- MethodBody.cs
- ClientSettings.cs
- SemaphoreFullException.cs
- DBCommandBuilder.cs
- XmlILOptimizerVisitor.cs
- XsltSettings.cs
- RoutingUtilities.cs
- VarRefManager.cs
- ContentDisposition.cs
- SByteStorage.cs
- TypeUnloadedException.cs
- DBConnectionString.cs
- SoapIncludeAttribute.cs
- messageonlyhwndwrapper.cs
- CompositeFontParser.cs
- TextTreeRootNode.cs
- WebRequestModuleElementCollection.cs
- HotSpotCollection.cs
- TypeHelpers.cs
- RijndaelManaged.cs
- SchemaName.cs
- URI.cs
- IISUnsafeMethods.cs
- AuthorizationPolicyTypeElement.cs
- SharedTcpTransportManager.cs
- MessageDecoder.cs
- IgnoreDeviceFilterElement.cs
- EntityStoreSchemaGenerator.cs
- WmlTextBoxAdapter.cs
- ISAPIRuntime.cs
- ErrorFormatter.cs
- AttributeUsageAttribute.cs
- DataGridViewAdvancedBorderStyle.cs
- ListDictionary.cs
- UntrustedRecipientException.cs
- CompilerWrapper.cs
- FixedMaxHeap.cs
- TreeNodeStyleCollection.cs
- CommonGetThemePartSize.cs
- bidPrivateBase.cs
- EventLogStatus.cs
- DataPagerFieldItem.cs
- SchemaObjectWriter.cs
- EastAsianLunisolarCalendar.cs
- DesignerView.xaml.cs
- DesignSurface.cs
- PageThemeParser.cs
- X509SecurityTokenAuthenticator.cs
- ToolStripDropDown.cs
- DropShadowEffect.cs
- JavaScriptObjectDeserializer.cs
- ContextStaticAttribute.cs
- SeverityFilter.cs
- ToolStripItemDataObject.cs
- SByteConverter.cs
- FixedStringLookup.cs
- ReplacementText.cs
- InstanceCreationEditor.cs
- DynamicILGenerator.cs
- RegexInterpreter.cs
- SchemaImporter.cs
- CounterCreationData.cs
- HtmlInputRadioButton.cs
- TabControl.cs
- BoundColumn.cs
- PageParserFilter.cs
- WebReferencesBuildProvider.cs
- ProxyFragment.cs
- SqlServer2KCompatibilityCheck.cs
- DataGridViewCellStyleChangedEventArgs.cs
- Accessible.cs
- CellParagraph.cs
- PackageStore.cs
- FixedDSBuilder.cs
- WhitespaceRuleReader.cs
- SecurityHeader.cs
- KeyTime.cs
- MethodBuilder.cs
- Operator.cs
- CannotUnloadAppDomainException.cs
- CacheChildrenQuery.cs
- WmlPageAdapter.cs
- VideoDrawing.cs
- FormsAuthenticationModule.cs
- TopClause.cs
- CategoryAttribute.cs
- VirtualPathProvider.cs
- SafeFindHandle.cs
- StringSorter.cs
- EntitySqlQueryCacheKey.cs
- _Semaphore.cs
- DebugView.cs