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
- DateTimeConstantAttribute.cs
- CompilerInfo.cs
- LocalBuilder.cs
- CompilerScopeManager.cs
- DataSetUtil.cs
- EndpointIdentity.cs
- ObjectConverter.cs
- KnownTypesHelper.cs
- XmlMessageFormatter.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- DelegateSerializationHolder.cs
- ExpandCollapseProviderWrapper.cs
- DataObjectPastingEventArgs.cs
- QuotedPrintableStream.cs
- IResourceProvider.cs
- DbParameterCollectionHelper.cs
- UpdateManifestForBrowserApplication.cs
- DrawingContextDrawingContextWalker.cs
- SqlDataSourceConfigureSortForm.cs
- CompiledELinqQueryState.cs
- XmlSortKey.cs
- MimeTypeAttribute.cs
- InkCollectionBehavior.cs
- Events.cs
- SecurityHelper.cs
- CheckBoxPopupAdapter.cs
- ChunkedMemoryStream.cs
- CommonProperties.cs
- HtmlInputImage.cs
- TimelineCollection.cs
- CookielessHelper.cs
- DBSchemaTable.cs
- AssociationSet.cs
- SchemaImporterExtension.cs
- DesignerWebPartChrome.cs
- AssemblyName.cs
- InputProcessorProfilesLoader.cs
- DelimitedListTraceListener.cs
- QuadraticBezierSegment.cs
- DSASignatureDeformatter.cs
- WindowsSspiNegotiation.cs
- FloaterParagraph.cs
- FormsAuthenticationCredentials.cs
- PersonalizableTypeEntry.cs
- TryLoadRunnableWorkflowCommand.cs
- ISessionStateStore.cs
- OledbConnectionStringbuilder.cs
- SettingsPropertyValue.cs
- CompilerResults.cs
- DrawingVisualDrawingContext.cs
- MethodCallTranslator.cs
- ReflectEventDescriptor.cs
- DoubleCollection.cs
- ProcessHost.cs
- Button.cs
- UpdateCompiler.cs
- ActivityTypeResolver.xaml.cs
- MouseWheelEventArgs.cs
- XmlSubtreeReader.cs
- SmiGettersStream.cs
- SqlDataReaderSmi.cs
- KeyPressEvent.cs
- glyphs.cs
- PropertyIDSet.cs
- TaskHelper.cs
- UITypeEditor.cs
- GridEntry.cs
- mda.cs
- TypedTableBase.cs
- BindingGroup.cs
- DeploymentExceptionMapper.cs
- HandleExceptionArgs.cs
- HttpCookie.cs
- InputScope.cs
- XmlException.cs
- RtfToken.cs
- ProxySimple.cs
- Quad.cs
- PenThreadWorker.cs
- ParameterReplacerVisitor.cs
- ProcessManager.cs
- EventMap.cs
- CachedTypeface.cs
- WebPartMenuStyle.cs
- ToolStripComboBox.cs
- Vector3D.cs
- XslTransformFileEditor.cs
- RectAnimationUsingKeyFrames.cs
- MatrixTransform.cs
- EntityStoreSchemaGenerator.cs
- RawContentTypeMapper.cs
- TypeForwardedToAttribute.cs
- UIElementAutomationPeer.cs
- LightweightCodeGenerator.cs
- ToolStripItemCollection.cs
- DataGridViewCheckBoxCell.cs
- ObjectItemCollectionAssemblyCacheEntry.cs
- CodeBlockBuilder.cs
- ExtensionSimplifierMarkupObject.cs
- XmlQueryType.cs