Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / XmlUtils / System / Xml / Xsl / Runtime / XmlILIndex.cs / 1305376 / 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
- PrivacyNoticeBindingElementImporter.cs
- SolidColorBrush.cs
- HostingEnvironmentSection.cs
- SmiContext.cs
- SQLBoolean.cs
- NonBatchDirectoryCompiler.cs
- ScalarRestriction.cs
- Control.cs
- PreloadedPackages.cs
- BridgeDataReader.cs
- SchemaInfo.cs
- SystemTcpConnection.cs
- HttpNamespaceReservationInstallComponent.cs
- ScriptMethodAttribute.cs
- SimpleTypeResolver.cs
- PropertyStore.cs
- Configuration.cs
- Tablet.cs
- CodeDirectoryCompiler.cs
- ObjectListCommandCollection.cs
- HttpCacheParams.cs
- XmlSchemaObjectCollection.cs
- DeviceSpecificDesigner.cs
- FreezableOperations.cs
- SettingsBase.cs
- DetailsViewDeleteEventArgs.cs
- ArgIterator.cs
- DataGridHeaderBorder.cs
- HandledEventArgs.cs
- DeflateStream.cs
- SchemaCollectionCompiler.cs
- UrlPath.cs
- ProviderConnectionPoint.cs
- PublisherIdentityPermission.cs
- KoreanLunisolarCalendar.cs
- TempEnvironment.cs
- SoapSchemaMember.cs
- SynchronizedDispatch.cs
- InputProviderSite.cs
- SettingsProperty.cs
- CodeAttachEventStatement.cs
- DataColumnSelectionConverter.cs
- UnSafeCharBuffer.cs
- Triangle.cs
- ParsedAttributeCollection.cs
- GenericIdentity.cs
- PageFunction.cs
- AggregateException.cs
- Material.cs
- CoreSwitches.cs
- PathSegmentCollection.cs
- SortQuery.cs
- PathData.cs
- ISSmlParser.cs
- PackWebResponse.cs
- ObjectQueryExecutionPlan.cs
- FrameworkContentElementAutomationPeer.cs
- ErrorsHelper.cs
- SqlNodeTypeOperators.cs
- TypeConverter.cs
- SimpleTypesSurrogate.cs
- NamedObject.cs
- RayMeshGeometry3DHitTestResult.cs
- StreamGeometry.cs
- Inline.cs
- ErrorLog.cs
- StorageEntityTypeMapping.cs
- Matrix.cs
- TrustSection.cs
- GridItemPattern.cs
- ConfigXmlSignificantWhitespace.cs
- EntityDataSourceConfigureObjectContextPanel.cs
- AnnotationStore.cs
- ToolStripOverflow.cs
- TracePayload.cs
- AutomationFocusChangedEventArgs.cs
- UICuesEvent.cs
- ValidationEventArgs.cs
- Number.cs
- Speller.cs
- WebPartZoneBase.cs
- CellQuery.cs
- Calendar.cs
- _BaseOverlappedAsyncResult.cs
- TraceShell.cs
- TreeNodeBinding.cs
- WindowShowOrOpenTracker.cs
- MULTI_QI.cs
- CodeSnippetCompileUnit.cs
- BitmapEffectState.cs
- EventSourceCreationData.cs
- ILGenerator.cs
- MulticastDelegate.cs
- PublisherIdentityPermission.cs
- Gdiplus.cs
- TransformedBitmap.cs
- Lock.cs
- ResourceCategoryAttribute.cs
- Soap11ServerProtocol.cs
- ContentTextAutomationPeer.cs