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
- StreamAsIStream.cs
- PKCS1MaskGenerationMethod.cs
- Viewport2DVisual3D.cs
- TransformerTypeCollection.cs
- dbdatarecord.cs
- LayoutTable.cs
- SinglePageViewer.cs
- PropertyEntry.cs
- CharacterMetrics.cs
- XmlDocument.cs
- NativeMethods.cs
- CompiledAction.cs
- SQLInt32.cs
- EntityCommand.cs
- ScrollViewerAutomationPeer.cs
- BorderGapMaskConverter.cs
- CompositeScriptReference.cs
- CqlErrorHelper.cs
- Rotation3DAnimationBase.cs
- IPGlobalProperties.cs
- ControlBindingsCollection.cs
- PersonalizationStateInfo.cs
- ToolStrip.cs
- X509InitiatorCertificateClientElement.cs
- JsonGlobals.cs
- FontInfo.cs
- HtmlFormWrapper.cs
- EntityProxyTypeInfo.cs
- CodeSnippetExpression.cs
- TogglePatternIdentifiers.cs
- ConnectionPointGlyph.cs
- Property.cs
- ThreadPoolTaskScheduler.cs
- GridViewColumnHeaderAutomationPeer.cs
- RowCache.cs
- EndpointDiscoveryMetadata.cs
- SocketAddress.cs
- NativeMethodsOther.cs
- AnnotationAuthorChangedEventArgs.cs
- ToolStripSettings.cs
- RootNamespaceAttribute.cs
- ObjectDataSourceEventArgs.cs
- AddInController.cs
- IODescriptionAttribute.cs
- XamlReaderHelper.cs
- MetadataCache.cs
- sqlser.cs
- HMACSHA256.cs
- ComponentChangedEvent.cs
- FixedSOMPage.cs
- CodeEntryPointMethod.cs
- xsdvalidator.cs
- CommandLibraryHelper.cs
- RNGCryptoServiceProvider.cs
- CodeNamespaceCollection.cs
- Action.cs
- ScriptingRoleServiceSection.cs
- ListViewSortEventArgs.cs
- PersonalizationStateQuery.cs
- Context.cs
- SerializerProvider.cs
- InstanceCreationEditor.cs
- AssociationSetEnd.cs
- FontDriver.cs
- Stroke.cs
- MatrixUtil.cs
- ScrollViewerAutomationPeer.cs
- XmlEventCache.cs
- ToolStripContainerDesigner.cs
- Schema.cs
- SecurityPermission.cs
- EntitySqlQueryBuilder.cs
- HttpResponseBase.cs
- DataColumnChangeEvent.cs
- Internal.cs
- XsdValidatingReader.cs
- SpeakCompletedEventArgs.cs
- WorkflowFormatterBehavior.cs
- ReadWriteObjectLock.cs
- _ShellExpression.cs
- EventMemberCodeDomSerializer.cs
- InstalledFontCollection.cs
- IResourceProvider.cs
- ActivityWithResultConverter.cs
- FlatButtonAppearance.cs
- NominalTypeEliminator.cs
- XmlSchemaAttributeGroupRef.cs
- ObjectDataSourceSelectingEventArgs.cs
- Point4DConverter.cs
- FileUtil.cs
- DataPager.cs
- InputLanguageManager.cs
- WindowsListViewItemCheckBox.cs
- ListBox.cs
- MulticastNotSupportedException.cs
- Size.cs
- InstanceNotFoundException.cs
- StylusButton.cs
- SoapFault.cs
- WebPartConnectionCollection.cs