Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // //[....] //----------------------------------------------------------------------------- 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.
Link Menu
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- LicFileLicenseProvider.cs
- PersonalizableAttribute.cs
- PointAnimationBase.cs
- PenContext.cs
- NonceToken.cs
- CodeBlockBuilder.cs
- EventLogEntryCollection.cs
- SerializerDescriptor.cs
- ProxyWebPartConnectionCollection.cs
- Container.cs
- SelectionEditor.cs
- NameValueCollection.cs
- ValueConversionAttribute.cs
- SafeNativeMethods.cs
- Identifier.cs
- SqlReorderer.cs
- FindRequestContext.cs
- URLString.cs
- IDispatchConstantAttribute.cs
- SmtpCommands.cs
- FigureParagraph.cs
- Page.cs
- IImplicitResourceProvider.cs
- XmlCompatibilityReader.cs
- Propagator.JoinPropagator.JoinPredicateVisitor.cs
- EntityKey.cs
- XmlSchemaElement.cs
- Fonts.cs
- ZoneButton.cs
- OracleConnectionFactory.cs
- ObjectQueryState.cs
- MouseBinding.cs
- GradientBrush.cs
- Misc.cs
- WebControlsSection.cs
- Pair.cs
- ScriptControlDescriptor.cs
- PropertyInformationCollection.cs
- HttpCachePolicy.cs
- CharEntityEncoderFallback.cs
- ChtmlPhoneCallAdapter.cs
- FixedDSBuilder.cs
- CapabilitiesAssignment.cs
- StructuredTypeEmitter.cs
- AppearanceEditorPart.cs
- PartitionerStatic.cs
- WebPartMovingEventArgs.cs
- WebHostUnsafeNativeMethods.cs
- LayeredChannelListener.cs
- StringInfo.cs
- MappingMetadataHelper.cs
- Point.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- SchemaTableOptionalColumn.cs
- _ListenerAsyncResult.cs
- DataControlFieldCell.cs
- WindowsFormsSynchronizationContext.cs
- PageSetupDialog.cs
- SqlMethodAttribute.cs
- UseLicense.cs
- Timeline.cs
- WorkflowApplicationAbortedEventArgs.cs
- EventLogger.cs
- RegistryDataKey.cs
- PrimitiveXmlSerializers.cs
- SqlClientMetaDataCollectionNames.cs
- TdsParserSessionPool.cs
- CellParaClient.cs
- DesignSurface.cs
- ReturnEventArgs.cs
- XmlHierarchicalEnumerable.cs
- StorageAssociationTypeMapping.cs
- DropShadowEffect.cs
- SqlBulkCopyColumnMapping.cs
- TransactionException.cs
- GAC.cs
- FieldCollectionEditor.cs
- Validator.cs
- ShaperBuffers.cs
- XComponentModel.cs
- PageFunction.cs
- CodeAttributeDeclaration.cs
- ZipIOLocalFileDataDescriptor.cs
- CodeTypeReference.cs
- MemberAssignment.cs
- BasicCellRelation.cs
- XmlSchemaObjectTable.cs
- XmlSignatureProperties.cs
- MachineKeySection.cs
- NonVisualControlAttribute.cs
- Pens.cs
- FormViewDeleteEventArgs.cs
- PointUtil.cs
- ArglessEventHandlerProxy.cs
- Window.cs
- XmlUtilWriter.cs
- BuiltInExpr.cs
- CriticalHandle.cs
- IisHelper.cs
- SqlOuterApplyReducer.cs