Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / followingquery.cs / 1305376 / followingquery.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace MS.Internal.Xml.XPath { using System; using System.Xml; using System.Xml.XPath; using System.Diagnostics; internal sealed class FollowingQuery : BaseAxisQuery { private XPathNavigator input; private XPathNodeIterator iterator; public FollowingQuery(Query qyInput, string name, string prefix, XPathNodeType typeTest) : base(qyInput, name, prefix, typeTest) {} private FollowingQuery(FollowingQuery other) : base(other) { this.input = Clone(other.input); this.iterator = Clone(other.iterator); } public override void Reset() { iterator = null; base.Reset(); } public override XPathNavigator Advance() { if (iterator == null) { input = qyInput.Advance(); if (input == null) { return null; } XPathNavigator prev; do { prev = input.Clone(); input = qyInput.Advance(); } while (prev.IsDescendant(input)); input = prev; iterator = XPathEmptyIterator.Instance; } while (! iterator.MoveNext()) { bool matchSelf; if (input.NodeType == XPathNodeType.Attribute || input.NodeType == XPathNodeType.Namespace) { input.MoveToParent(); matchSelf = false; } else { while (! input.MoveToNext()) { if (! input.MoveToParent()) { return null; } } matchSelf = true; } if (NameTest) { iterator = input.SelectDescendants(Name, Namespace, matchSelf); } else { iterator = input.SelectDescendants(TypeTest, matchSelf); } } position++; currentNode = iterator.Current; return currentNode; } public override XPathNodeIterator Clone() { return new FollowingQuery(this); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace MS.Internal.Xml.XPath { using System; using System.Xml; using System.Xml.XPath; using System.Diagnostics; internal sealed class FollowingQuery : BaseAxisQuery { private XPathNavigator input; private XPathNodeIterator iterator; public FollowingQuery(Query qyInput, string name, string prefix, XPathNodeType typeTest) : base(qyInput, name, prefix, typeTest) {} private FollowingQuery(FollowingQuery other) : base(other) { this.input = Clone(other.input); this.iterator = Clone(other.iterator); } public override void Reset() { iterator = null; base.Reset(); } public override XPathNavigator Advance() { if (iterator == null) { input = qyInput.Advance(); if (input == null) { return null; } XPathNavigator prev; do { prev = input.Clone(); input = qyInput.Advance(); } while (prev.IsDescendant(input)); input = prev; iterator = XPathEmptyIterator.Instance; } while (! iterator.MoveNext()) { bool matchSelf; if (input.NodeType == XPathNodeType.Attribute || input.NodeType == XPathNodeType.Namespace) { input.MoveToParent(); matchSelf = false; } else { while (! input.MoveToNext()) { if (! input.MoveToParent()) { return null; } } matchSelf = true; } if (NameTest) { iterator = input.SelectDescendants(Name, Namespace, matchSelf); } else { iterator = input.SelectDescendants(TypeTest, matchSelf); } } position++; currentNode = iterator.Current; return currentNode; } public override XPathNodeIterator Clone() { return new FollowingQuery(this); } } } // 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
- SystemColors.cs
- SoapIgnoreAttribute.cs
- GridItemProviderWrapper.cs
- TemplateParser.cs
- PropertyBuilder.cs
- XPathExpr.cs
- WSDualHttpBindingCollectionElement.cs
- PriorityQueue.cs
- VerificationAttribute.cs
- BooleanFunctions.cs
- Array.cs
- SafeMarshalContext.cs
- EndpointInfoCollection.cs
- RoutedEventValueSerializer.cs
- CachedCompositeFamily.cs
- NotSupportedException.cs
- ColumnMapCopier.cs
- PrefixQName.cs
- UICuesEvent.cs
- StylusShape.cs
- SourceFileBuildProvider.cs
- XamlValidatingReader.cs
- ResourceReferenceKeyNotFoundException.cs
- DataGridViewColumnCollection.cs
- SessionStateModule.cs
- XmlIgnoreAttribute.cs
- OneOfConst.cs
- QueueException.cs
- HiddenFieldPageStatePersister.cs
- VariantWrapper.cs
- Matrix3D.cs
- DefaultDialogButtons.cs
- MimeMultiPart.cs
- XamlFxTrace.cs
- TypeConvertions.cs
- ToolStripMenuItem.cs
- ConfigurationErrorsException.cs
- TreeBuilderXamlTranslator.cs
- AvTraceDetails.cs
- ConditionCollection.cs
- _LocalDataStore.cs
- ColumnResizeUndoUnit.cs
- EncryptedPackageFilter.cs
- DateTimeParse.cs
- Menu.cs
- SoapHeaderAttribute.cs
- CompensationExtension.cs
- ServiceParser.cs
- BitHelper.cs
- PointCollectionConverter.cs
- StylusPoint.cs
- XmlSchemaSimpleTypeUnion.cs
- TraceListener.cs
- DataGridDetailsPresenter.cs
- DefaultValidator.cs
- DataGridPageChangedEventArgs.cs
- ObjectDataSourceEventArgs.cs
- Transactions.cs
- StorageRoot.cs
- StylusSystemGestureEventArgs.cs
- ClusterSafeNativeMethods.cs
- RadioButtonBaseAdapter.cs
- TextServicesCompartmentEventSink.cs
- BuildResultCache.cs
- RawStylusActions.cs
- MeasureItemEvent.cs
- EnumValAlphaComparer.cs
- smtppermission.cs
- SimpleColumnProvider.cs
- StylusButton.cs
- CompModSwitches.cs
- ColorKeyFrameCollection.cs
- BuildProvider.cs
- ReversePositionQuery.cs
- ProfilePropertySettingsCollection.cs
- ProviderException.cs
- OutputScopeManager.cs
- AssemblyCollection.cs
- TextPattern.cs
- ConnectionPoint.cs
- ComponentDispatcherThread.cs
- ChildChangedEventArgs.cs
- DataGridViewRowCancelEventArgs.cs
- SQLByteStorage.cs
- DeviceContexts.cs
- Char.cs
- UInt64Converter.cs
- ToolStripAdornerWindowService.cs
- ListViewUpdatedEventArgs.cs
- CatchBlock.cs
- UndirectedGraph.cs
- MailAddressCollection.cs
- FileDialogPermission.cs
- WindowsContainer.cs
- ScriptManagerProxy.cs
- TextUtf8RawTextWriter.cs
- WindowsRegion.cs
- TextServicesLoader.cs
- DbDataSourceEnumerator.cs
- ResourceReferenceExpression.cs