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
- AutomationPropertyChangedEventArgs.cs
- ControlBindingsConverter.cs
- OleStrCAMarshaler.cs
- RootBrowserWindowProxy.cs
- ObjectMaterializedEventArgs.cs
- ReflectionPermission.cs
- ClientScriptManager.cs
- CodeAttributeArgument.cs
- FontWeight.cs
- WebServiceParameterData.cs
- EnvironmentPermission.cs
- VisualCollection.cs
- PropertyToken.cs
- XmlReaderSettings.cs
- SignedPkcs7.cs
- _IPv6Address.cs
- Sequence.cs
- EventListener.cs
- HintTextConverter.cs
- WebBrowserNavigatingEventHandler.cs
- SimpleRecyclingCache.cs
- ReferenceEqualityComparer.cs
- SiteMapNodeItemEventArgs.cs
- CssStyleCollection.cs
- FrameworkContextData.cs
- Empty.cs
- DependencyObjectValidator.cs
- PeerUnsafeNativeCryptMethods.cs
- SelectedDatesCollection.cs
- SemanticAnalyzer.cs
- Vector.cs
- DynamicUpdateCommand.cs
- BindingMemberInfo.cs
- IPEndPoint.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- CodeDelegateCreateExpression.cs
- DataSetUtil.cs
- BitmapImage.cs
- RedistVersionInfo.cs
- DragDeltaEventArgs.cs
- ObjectSecurity.cs
- StringInfo.cs
- RIPEMD160Managed.cs
- HandlerFactoryWrapper.cs
- IconConverter.cs
- AnnotationResourceChangedEventArgs.cs
- XmlImplementation.cs
- ResourceType.cs
- DiscoveryDocumentLinksPattern.cs
- CultureInfo.cs
- CommentAction.cs
- WindowsStartMenu.cs
- WasHttpHandlersInstallComponent.cs
- EUCJPEncoding.cs
- DBNull.cs
- RawAppCommandInputReport.cs
- InstancePersistenceEvent.cs
- UIElement3D.cs
- ProfileEventArgs.cs
- FileRecordSequenceCompletedAsyncResult.cs
- ListViewCommandEventArgs.cs
- PropertiesTab.cs
- Margins.cs
- ScrollItemPattern.cs
- BindingListCollectionView.cs
- InternalConfigRoot.cs
- NonVisualControlAttribute.cs
- TableLayoutStyle.cs
- EmptyEnumerator.cs
- PathStreamGeometryContext.cs
- Color.cs
- SkipQueryOptionExpression.cs
- CodeLinePragma.cs
- OperationFormatStyle.cs
- SchemaTypeEmitter.cs
- GridViewDeleteEventArgs.cs
- ToolboxItem.cs
- SqlGatherProducedAliases.cs
- SliderAutomationPeer.cs
- StoreConnection.cs
- DataBindingExpressionBuilder.cs
- EventWaitHandle.cs
- SmtpClient.cs
- ContextQuery.cs
- ConfigurationSectionGroup.cs
- DataGridColumnFloatingHeader.cs
- ColorContextHelper.cs
- WsatAdminException.cs
- TransformValueSerializer.cs
- FocusManager.cs
- ServiceModelReg.cs
- WebPartDisplayModeCollection.cs
- _OSSOCK.cs
- Brush.cs
- XmlStreamStore.cs
- WhileDesigner.cs
- NeutralResourcesLanguageAttribute.cs
- NavigationProgressEventArgs.cs
- HwndHostAutomationPeer.cs
- XmlEncoding.cs