Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / DescendantBaseQuery.cs / 1305376 / DescendantBaseQuery.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 abstract class DescendantBaseQuery : BaseAxisQuery {
protected bool matchSelf;
protected bool abbrAxis;
public DescendantBaseQuery(Query qyParent, string Name, string Prefix, XPathNodeType Type, bool matchSelf, bool abbrAxis) : base(qyParent, Name, Prefix, Type) {
this.matchSelf = matchSelf;
this.abbrAxis = abbrAxis;
}
public DescendantBaseQuery(DescendantBaseQuery other) : base(other) {
this.matchSelf = other.matchSelf;
this.abbrAxis = other.abbrAxis;
}
public override XPathNavigator MatchNode(XPathNavigator context) {
if (context != null) {
if (!abbrAxis) {
throw XPathException.Create(Res.Xp_InvalidPattern);
}
XPathNavigator result = null;
if (matches(context)) {
if (matchSelf) {
if ((result = qyInput.MatchNode(context)) != null) {
return result;
}
}
XPathNavigator anc = context.Clone();
while (anc.MoveToParent()) {
if ((result = qyInput.MatchNode(anc)) != null) {
return result;
}
}
}
}
return null;
}
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

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- TextSerializer.cs
- SHA512Managed.cs
- CheckBoxPopupAdapter.cs
- HwndKeyboardInputProvider.cs
- HttpBindingExtension.cs
- LoginAutoFormat.cs
- DocumentGridContextMenu.cs
- ConfigUtil.cs
- TextParagraph.cs
- MemberInitExpression.cs
- SliderAutomationPeer.cs
- DbReferenceCollection.cs
- SortFieldComparer.cs
- SQLByteStorage.cs
- DataGridAutomationPeer.cs
- LifetimeServices.cs
- XNodeNavigator.cs
- Control.cs
- KeyValueConfigurationCollection.cs
- Activator.cs
- WorkflowMessageEventArgs.cs
- DataObjectCopyingEventArgs.cs
- TimersDescriptionAttribute.cs
- IMembershipProvider.cs
- SQLMoneyStorage.cs
- SmtpMail.cs
- Events.cs
- XmlParser.cs
- PlaceHolder.cs
- ItemsControl.cs
- FusionWrap.cs
- Page.cs
- ColumnResizeUndoUnit.cs
- Material.cs
- FileUtil.cs
- PhoneCall.cs
- AssociatedControlConverter.cs
- TraceContextRecord.cs
- DLinqColumnProvider.cs
- formatter.cs
- HashHelper.cs
- XappLauncher.cs
- TemplatedAdorner.cs
- CallbackTimeoutsBehavior.cs
- PathGeometry.cs
- ProfileGroupSettingsCollection.cs
- RoleManagerEventArgs.cs
- GeneralTransform3DGroup.cs
- ComEventsMethod.cs
- BuildManager.cs
- AssemblyBuilder.cs
- TypeResolver.cs
- CompiledQueryCacheKey.cs
- ArraySet.cs
- StoreItemCollection.cs
- ProcessModelSection.cs
- FixedSOMPageElement.cs
- RoleService.cs
- OleAutBinder.cs
- AuthStoreRoleProvider.cs
- PerformanceCountersElement.cs
- FrugalList.cs
- SQLMembershipProvider.cs
- MediaEntryAttribute.cs
- DelayedRegex.cs
- AlphabeticalEnumConverter.cs
- WeakHashtable.cs
- Matrix3DStack.cs
- DataBindingCollection.cs
- MgmtConfigurationRecord.cs
- QilBinary.cs
- RegexCapture.cs
- ProcessProtocolHandler.cs
- TransformCollection.cs
- RightsManagementPermission.cs
- KoreanLunisolarCalendar.cs
- Int32Rect.cs
- ImageInfo.cs
- ImageSource.cs
- AutomationPeer.cs
- StringToken.cs
- ProtocolsConfigurationEntry.cs
- SHA512.cs
- XmlILIndex.cs
- SessionStateSection.cs
- BaseCollection.cs
- GridViewAutomationPeer.cs
- SchemaComplexType.cs
- TabControlAutomationPeer.cs
- StringFreezingAttribute.cs
- GridToolTip.cs
- SmiSettersStream.cs
- MachineKeySection.cs
- WebPartEditorCancelVerb.cs
- DateRangeEvent.cs
- ProviderConnectionPoint.cs
- ProfessionalColors.cs
- FirstMatchCodeGroup.cs
- AstNode.cs
- SafeMILHandleMemoryPressure.cs