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
- XmlBoundElement.cs
- NetTcpSecurity.cs
- EventSinkHelperWriter.cs
- WebPartEditorCancelVerb.cs
- HttpResponse.cs
- ResourcePart.cs
- ToolStripLocationCancelEventArgs.cs
- HtmlInputSubmit.cs
- EncoderParameters.cs
- SchemaNames.cs
- GenericsNotImplementedException.cs
- DataColumnMappingCollection.cs
- ASCIIEncoding.cs
- DataContractJsonSerializerOperationBehavior.cs
- DiscoveryEndpointElement.cs
- NativeObjectSecurity.cs
- EditCommandColumn.cs
- SetterBase.cs
- GlobalId.cs
- ImageIndexConverter.cs
- OutputCacheSection.cs
- AddInToken.cs
- OdbcDataReader.cs
- EntityClientCacheEntry.cs
- HandleCollector.cs
- AsymmetricKeyExchangeDeformatter.cs
- DocumentPaginator.cs
- OpacityConverter.cs
- UrlMappingsModule.cs
- SimpleFileLog.cs
- XmlRawWriter.cs
- EntityDataSourceWizardForm.cs
- EventLevel.cs
- FixedSOMLineRanges.cs
- UnsettableComboBox.cs
- DoWorkEventArgs.cs
- Separator.cs
- RequestSecurityToken.cs
- SqlGenerator.cs
- Closure.cs
- ScrollItemProviderWrapper.cs
- UidManager.cs
- DirectionalLight.cs
- NamedElement.cs
- DrawingAttributesDefaultValueFactory.cs
- SerialReceived.cs
- ActivityBuilderHelper.cs
- ScrollableControl.cs
- ListBox.cs
- ImageMapEventArgs.cs
- SqlConnectionPoolProviderInfo.cs
- CDSsyncETWBCLProvider.cs
- SimpleType.cs
- WCFBuildProvider.cs
- InstalledFontCollection.cs
- ListViewItem.cs
- OrderedDictionaryStateHelper.cs
- __Error.cs
- SmiMetaDataProperty.cs
- TTSEvent.cs
- XmlSchemaDocumentation.cs
- CryptoProvider.cs
- ColorAnimationBase.cs
- RefreshResponseInfo.cs
- SourceItem.cs
- MdbDataFileEditor.cs
- DbProviderManifest.cs
- FileDetails.cs
- TdsParserHelperClasses.cs
- SqlMetaData.cs
- DynamicMethod.cs
- WebPartsPersonalizationAuthorization.cs
- XmlSchemaSubstitutionGroup.cs
- Shape.cs
- BitmapFrame.cs
- BuildTopDownAttribute.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- CheckBoxAutomationPeer.cs
- SqlProcedureAttribute.cs
- CheckBoxList.cs
- KeyValuePairs.cs
- EncryptedKeyIdentifierClause.cs
- CompilerGeneratedAttribute.cs
- ServiceModelTimeSpanValidator.cs
- WebConfigurationManager.cs
- HttpServerChannel.cs
- OverlappedAsyncResult.cs
- RadioButton.cs
- DataSourceCache.cs
- ListDictionary.cs
- SymbolPair.cs
- ToolStripSettings.cs
- TextRangeBase.cs
- TreeViewImageKeyConverter.cs
- sitestring.cs
- dsa.cs
- RangeEnumerable.cs
- Image.cs
- TraceSwitch.cs
- DateTimeConstantAttribute.cs