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 / DescendantBaseQuery.cs / 1 / 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.
//------------------------------------------------------------------------------
//
// 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
- StickyNoteAnnotations.cs
- VSDExceptions.cs
- BindingExpressionUncommonField.cs
- Wrapper.cs
- OpenFileDialog.cs
- ImageListUtils.cs
- PropertyGridDesigner.cs
- DocumentViewerConstants.cs
- WmlListAdapter.cs
- HwndKeyboardInputProvider.cs
- Attribute.cs
- SystemWebCachingSectionGroup.cs
- XmlWrappingReader.cs
- SqlException.cs
- AssemblyAssociatedContentFileAttribute.cs
- DBNull.cs
- CellRelation.cs
- Message.cs
- UnsafeNativeMethodsMilCoreApi.cs
- RelationshipSet.cs
- NativeConfigurationLoader.cs
- NavigationWindow.cs
- TextDecorationCollection.cs
- ModifiableIteratorCollection.cs
- NewArrayExpression.cs
- MenuScrollingVisibilityConverter.cs
- SecurityPermission.cs
- ITreeGenerator.cs
- StickyNote.cs
- BatchWriter.cs
- WebConfigurationManager.cs
- MouseActionConverter.cs
- SoapAttributes.cs
- QilInvoke.cs
- ToggleProviderWrapper.cs
- basevalidator.cs
- DataProviderNameConverter.cs
- PackWebResponse.cs
- UrlMappingsSection.cs
- TimeSpanConverter.cs
- DateTimeUtil.cs
- CodeDirectionExpression.cs
- FunctionMappingTranslator.cs
- EncodingConverter.cs
- FixedTextContainer.cs
- SimpleType.cs
- sqlnorm.cs
- QilChoice.cs
- TextFormatterHost.cs
- UriParserTemplates.cs
- DataTrigger.cs
- WebCategoryAttribute.cs
- NativeMethods.cs
- HttpModuleCollection.cs
- Mutex.cs
- ConstrainedGroup.cs
- DBCSCodePageEncoding.cs
- Point4DConverter.cs
- SecurityTokenTypes.cs
- EdmValidator.cs
- CodeDOMUtility.cs
- PageStatePersister.cs
- StateWorkerRequest.cs
- ErrorEventArgs.cs
- CapabilitiesState.cs
- DataGridLengthConverter.cs
- JapaneseLunisolarCalendar.cs
- DataGridAddNewRow.cs
- ExceptionValidationRule.cs
- ClassDataContract.cs
- RowBinding.cs
- DictionaryManager.cs
- GridItem.cs
- SchemaObjectWriter.cs
- UriWriter.cs
- Misc.cs
- KerberosReceiverSecurityToken.cs
- FormsAuthenticationTicket.cs
- DbProviderFactories.cs
- BamlLocalizerErrorNotifyEventArgs.cs
- ObjectViewListener.cs
- HMACSHA1.cs
- ConfigXmlText.cs
- DBConcurrencyException.cs
- DuplexClientBase.cs
- ObjectDataSourceStatusEventArgs.cs
- DbParameterHelper.cs
- SqlInternalConnectionTds.cs
- ServiceProviders.cs
- ConcurrentBag.cs
- MoveSizeWinEventHandler.cs
- WebPartConnectionsConfigureVerb.cs
- TypeConverterHelper.cs
- PolicyLevel.cs
- TemplatedAdorner.cs
- DataGridViewCellPaintingEventArgs.cs
- DirectoryNotFoundException.cs
- FreezableOperations.cs
- BuildProviderUtils.cs
- QilLoop.cs