Code:
/ DotNET / DotNET / 8.0 / untmp / whidbey / REDBITS / ndp / fx / src / Xml / System / Xml / XPath / Internal / XPathAncestorQuery.cs / 1 / XPathAncestorQuery.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; using System.Collections.Generic; internal sealed class XPathAncestorQuery : CacheAxisQuery { private bool matchSelf; public XPathAncestorQuery(Query qyInput, string name, string prefix, XPathNodeType typeTest, bool matchSelf) : base(qyInput, name, prefix, typeTest) { this.matchSelf = matchSelf; } private XPathAncestorQuery(XPathAncestorQuery other) : base(other) { this.matchSelf = other.matchSelf; } public override object Evaluate(XPathNodeIterator context) { base.Evaluate(context); XPathNavigator ancestor = null; XPathNavigator input; while ((input = qyInput.Advance()) != null) { if (matchSelf) { if (matches(input)) { if (!Insert(outputBuffer, input)) { // If input is already in output buffer all its ancestors are in a buffer as well. continue; } } } if (ancestor == null || ! ancestor.MoveTo(input)) { ancestor = input.Clone(); } while (ancestor.MoveToParent()) { if (matches(ancestor)) { if (!Insert(outputBuffer, ancestor)) { // If input is already in output buffer all its ancestors are in a buffer as well. break; } } } } return this; } public override XPathNodeIterator Clone() { return new XPathAncestorQuery(this); } public override int CurrentPosition { get { return outputBuffer.Count - count + 1; } } public override QueryProps Properties { get { return base.Properties | QueryProps.Reverse; } } public override void PrintQuery(XmlWriter w) { w.WriteStartElement(this.GetType().Name); if (matchSelf) { w.WriteAttributeString("self", "yes"); } if (NameTest) { w.WriteAttributeString("name", Prefix.Length != 0 ? Prefix + ':' + Name : Name); } if (TypeTest != XPathNodeType.Element) { w.WriteAttributeString("nodeType", TypeTest.ToString()); } qyInput.PrintQuery(w); w.WriteEndElement(); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- KeyValuePair.cs
- Currency.cs
- RenderCapability.cs
- SqlSelectClauseBuilder.cs
- SQLBytesStorage.cs
- XmlNamespaceMappingCollection.cs
- XmlSerializerNamespaces.cs
- CursorConverter.cs
- PhysicalAddress.cs
- ScriptRef.cs
- NonVisualControlAttribute.cs
- HttpChannelHelper.cs
- TreeChangeInfo.cs
- UnmanagedMarshal.cs
- Html32TextWriter.cs
- SystemInformation.cs
- KeyboardInputProviderAcquireFocusEventArgs.cs
- ValidationManager.cs
- HTTPNotFoundHandler.cs
- CodeCatchClause.cs
- Helper.cs
- StringUtil.cs
- HtmlTableCellCollection.cs
- SocketAddress.cs
- RandomNumberGenerator.cs
- ContentHostHelper.cs
- ProxyElement.cs
- InternalBufferOverflowException.cs
- PtsHelper.cs
- PanelStyle.cs
- UnknownWrapper.cs
- NumberSubstitution.cs
- CaseInsensitiveHashCodeProvider.cs
- SQLByte.cs
- EntityTypeEmitter.cs
- BroadcastEventHelper.cs
- DeviceContext.cs
- XmlElementAttribute.cs
- MobileControlsSectionHelper.cs
- TrackingCondition.cs
- DataGridViewTopRowAccessibleObject.cs
- PeerNameResolver.cs
- OleDbDataReader.cs
- _TransmitFileOverlappedAsyncResult.cs
- XmlArrayAttribute.cs
- Ipv6Element.cs
- _CookieModule.cs
- _NegoStream.cs
- SymbolDocumentGenerator.cs
- WebHttpBehavior.cs
- CustomSignedXml.cs
- SrgsSubset.cs
- EmbeddedObject.cs
- UpdateRecord.cs
- LoginUtil.cs
- ReturnValue.cs
- DataGridTemplateColumn.cs
- PrintDocument.cs
- XmlKeywords.cs
- X509AsymmetricSecurityKey.cs
- DataTablePropertyDescriptor.cs
- PeerInputChannel.cs
- UnsafeNativeMethods.cs
- Inline.cs
- UnmanagedMemoryStreamWrapper.cs
- HierarchicalDataBoundControlAdapter.cs
- SqlWebEventProvider.cs
- _BasicClient.cs
- Vector3DValueSerializer.cs
- ChangeToolStripParentVerb.cs
- WebControlParameterProxy.cs
- XmlUtf8RawTextWriter.cs
- MethodBuilder.cs
- ExpressionConverter.cs
- mediapermission.cs
- DataGridViewMethods.cs
- FormsAuthenticationConfiguration.cs
- storagemappingitemcollection.viewdictionary.cs
- ComponentDispatcher.cs
- ArraySubsetEnumerator.cs
- DataControlButton.cs
- VisualStyleRenderer.cs
- EntityDataSourceDesignerHelper.cs
- XamlFilter.cs
- MobileErrorInfo.cs
- UnionCodeGroup.cs
- RectangleConverter.cs
- SafeArrayRankMismatchException.cs
- SystemIPv6InterfaceProperties.cs
- SendAgentStatusRequest.cs
- GlyphRun.cs
- ReliableDuplexSessionChannel.cs
- XmlWrappingWriter.cs
- GraphicsPath.cs
- EdmEntityTypeAttribute.cs
- IdnElement.cs
- AuthorizationPolicyTypeElement.cs
- _StreamFramer.cs
- RawStylusInputCustomDataList.cs
- FormsAuthentication.cs