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
- ButtonChrome.cs
- FixedElement.cs
- X509Chain.cs
- FixedSOMGroup.cs
- TextBox.cs
- StringToken.cs
- HideDisabledControlAdapter.cs
- TransformPattern.cs
- EntityDataSourceReferenceGroup.cs
- WorkflowServiceBehavior.cs
- LabelDesigner.cs
- connectionpool.cs
- HtmlPageAdapter.cs
- UIAgentInitializationException.cs
- UpdatePanel.cs
- CommentEmitter.cs
- TailCallAnalyzer.cs
- InputLanguageEventArgs.cs
- WebUtil.cs
- SqlDataSourceCache.cs
- ManagementQuery.cs
- EastAsianLunisolarCalendar.cs
- SingleResultAttribute.cs
- RepeaterCommandEventArgs.cs
- Decorator.cs
- BoundPropertyEntry.cs
- ProcessModuleCollection.cs
- IODescriptionAttribute.cs
- Window.cs
- CollectionType.cs
- PropertyCollection.cs
- SplitterCancelEvent.cs
- BuilderElements.cs
- PaperSource.cs
- MailWebEventProvider.cs
- UnknownBitmapDecoder.cs
- CopyCodeAction.cs
- CorrelationActionMessageFilter.cs
- XmlDataSourceNodeDescriptor.cs
- SoapParser.cs
- Dispatcher.cs
- StructuredProperty.cs
- ListenerPerfCounters.cs
- QilPatternFactory.cs
- MDIControlStrip.cs
- ListViewTableRow.cs
- HMACSHA384.cs
- SafeThreadHandle.cs
- WebPartEditorOkVerb.cs
- DataGridViewRowDividerDoubleClickEventArgs.cs
- DelegateCompletionCallbackWrapper.cs
- BuildProvider.cs
- BinaryKeyIdentifierClause.cs
- SafeNativeMethods.cs
- ThicknessAnimationBase.cs
- ping.cs
- safex509handles.cs
- Timeline.cs
- EncryptedKeyIdentifierClause.cs
- RectIndependentAnimationStorage.cs
- COM2FontConverter.cs
- XmlTextAttribute.cs
- SqlErrorCollection.cs
- CollectionDataContract.cs
- Rule.cs
- Model3DGroup.cs
- SystemIcmpV6Statistics.cs
- WebRequestModuleElement.cs
- XPathNavigatorReader.cs
- Confirm.cs
- IERequestCache.cs
- CodeTypeReferenceExpression.cs
- ToolStripItem.cs
- IsolatedStoragePermission.cs
- WindowsStatic.cs
- HwndSubclass.cs
- BookmarkScope.cs
- ScriptIgnoreAttribute.cs
- XsdDuration.cs
- AxHost.cs
- Byte.cs
- SerializerWriterEventHandlers.cs
- GZipDecoder.cs
- LinqTreeNodeEvaluator.cs
- TypeInfo.cs
- MdImport.cs
- SqlErrorCollection.cs
- PaginationProgressEventArgs.cs
- DocobjHost.cs
- ComboBoxAutomationPeer.cs
- Compiler.cs
- NamespaceInfo.cs
- MethodResolver.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- DataObjectCopyingEventArgs.cs
- TextProperties.cs
- UIntPtr.cs
- PerformanceCounterTraceRecord.cs
- ExtensibleClassFactory.cs
- HostingPreferredMapPath.cs