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
- ContainerVisual.cs
- XmlCharCheckingReader.cs
- Vector3D.cs
- Bezier.cs
- ComplexPropertyEntry.cs
- SystemGatewayIPAddressInformation.cs
- MailMessage.cs
- Partitioner.cs
- UnsafeNativeMethods.cs
- DependencyPropertyChangedEventArgs.cs
- SerialPort.cs
- CodeDomComponentSerializationService.cs
- EntityConnectionStringBuilderItem.cs
- IProvider.cs
- BaseAddressPrefixFilterElementCollection.cs
- DoubleLink.cs
- DependencyObject.cs
- AddInDeploymentState.cs
- CodeTypeOfExpression.cs
- EntityDataSourceChangedEventArgs.cs
- RequestCachingSection.cs
- HashAlgorithm.cs
- FeatureSupport.cs
- TableItemStyle.cs
- TreeNodeStyle.cs
- EntityDataSourceView.cs
- CountdownEvent.cs
- EFAssociationProvider.cs
- SymmetricAlgorithm.cs
- XNameConverter.cs
- AttributeProviderAttribute.cs
- Rotation3D.cs
- RequestQueryProcessor.cs
- IPEndPointCollection.cs
- RefreshEventArgs.cs
- SqlRetyper.cs
- EventArgs.cs
- AssociationTypeEmitter.cs
- AppDomainProtocolHandler.cs
- Transform.cs
- RewritingPass.cs
- HostingMessageProperty.cs
- ListComponentEditorPage.cs
- ConstraintCollection.cs
- EndOfStreamException.cs
- OrCondition.cs
- RenderingEventArgs.cs
- ObjectStateFormatter.cs
- Stylesheet.cs
- TrustSection.cs
- XXXInfos.cs
- Inline.cs
- _LoggingObject.cs
- Graph.cs
- Stroke2.cs
- ErrorWebPart.cs
- LocatorGroup.cs
- indexingfiltermarshaler.cs
- BamlLocalizer.cs
- BatchParser.cs
- SafeNativeMethodsMilCoreApi.cs
- DictionaryContent.cs
- HttpRequestWrapper.cs
- RankException.cs
- ManualResetEventSlim.cs
- QuadraticBezierSegment.cs
- OpenTypeCommon.cs
- InstalledFontCollection.cs
- CodeMethodInvokeExpression.cs
- XmlSchemaValidator.cs
- LocatorBase.cs
- UidManager.cs
- MetadataWorkspace.cs
- VisualProxy.cs
- DbgUtil.cs
- CalculatedColumn.cs
- ReferenceConverter.cs
- ISFTagAndGuidCache.cs
- TailCallAnalyzer.cs
- OdbcConnectionFactory.cs
- SchemaNamespaceManager.cs
- SAPIEngineTypes.cs
- DoubleAnimationUsingPath.cs
- SystemDiagnosticsSection.cs
- CornerRadiusConverter.cs
- Model3DCollection.cs
- AuthenticationServiceManager.cs
- DesignTimeVisibleAttribute.cs
- PseudoWebRequest.cs
- RequestTimeoutManager.cs
- WebEvents.cs
- ConfigurationManagerHelper.cs
- CompilationRelaxations.cs
- QueryResult.cs
- XmlDictionaryWriter.cs
- XmlSchemaProviderAttribute.cs
- EllipseGeometry.cs
- RTLAwareMessageBox.cs
- ServiceThrottlingElement.cs
- UnknownMessageReceivedEventArgs.cs