Code:
/ 4.0 / 4.0 / 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.
//------------------------------------------------------------------------------
//
// 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
- Bits.cs
- PropertyKey.cs
- __ConsoleStream.cs
- webbrowsersite.cs
- TransactionBridge.cs
- StringCollection.cs
- KeyedHashAlgorithm.cs
- HttpPostedFile.cs
- PageHandlerFactory.cs
- DelegateTypeInfo.cs
- PersonalizationDictionary.cs
- AtlasWeb.Designer.cs
- SqlInternalConnection.cs
- FtpWebRequest.cs
- HyperLinkStyle.cs
- VarRemapper.cs
- TemplateFactory.cs
- XmlLoader.cs
- CompilerCollection.cs
- followingsibling.cs
- UnsafeNativeMethods.cs
- UrlMapping.cs
- SiteMapNode.cs
- StringSorter.cs
- XamlTypeMapper.cs
- RequestContextBase.cs
- AnimationClock.cs
- PropertyBuilder.cs
- CustomCategoryAttribute.cs
- CompilerCollection.cs
- SqlCommandBuilder.cs
- SqlStream.cs
- UdpRetransmissionSettings.cs
- DialogResultConverter.cs
- RemoteWebConfigurationHostStream.cs
- VisualBasicValue.cs
- PcmConverter.cs
- ScrollViewer.cs
- Compiler.cs
- FolderBrowserDialog.cs
- IIS7UserPrincipal.cs
- TCPListener.cs
- BitmapInitialize.cs
- BeginCreateSecurityTokenRequest.cs
- ProjectionQueryOptionExpression.cs
- Queue.cs
- DispatcherExceptionEventArgs.cs
- CqlParserHelpers.cs
- Interlocked.cs
- APCustomTypeDescriptor.cs
- X509CertificateStore.cs
- Soap12ServerProtocol.cs
- ConfigurationErrorsException.cs
- TypeNameConverter.cs
- ObjectStateEntry.cs
- HtmlTableCell.cs
- SecuritySessionFilter.cs
- ExpandSegment.cs
- SourceFilter.cs
- FederatedMessageSecurityOverHttpElement.cs
- ConsoleEntryPoint.cs
- SharedStream.cs
- IProducerConsumerCollection.cs
- NumericUpDown.cs
- SqlFacetAttribute.cs
- Utilities.cs
- DataGridViewRowCancelEventArgs.cs
- StrokeFIndices.cs
- TypeUtil.cs
- CoreSwitches.cs
- SchemaImporter.cs
- StrokeNodeOperations.cs
- DataTrigger.cs
- XmlAttributeCache.cs
- MonthChangedEventArgs.cs
- ColorConverter.cs
- LinqDataSourceView.cs
- WebReferencesBuildProvider.cs
- CryptoProvider.cs
- FontFaceLayoutInfo.cs
- ZoneIdentityPermission.cs
- MessagePartSpecification.cs
- QilNode.cs
- GPPOINTF.cs
- MobileFormsAuthentication.cs
- RoleManagerModule.cs
- VerificationAttribute.cs
- NumericExpr.cs
- SqlNamer.cs
- wgx_sdk_version.cs
- PointHitTestResult.cs
- ModuleConfigurationInfo.cs
- WizardStepCollectionEditor.cs
- MeasurementDCInfo.cs
- BamlBinaryWriter.cs
- MediaElementAutomationPeer.cs
- CellNormalizer.cs
- ExtractedStateEntry.cs
- ActivityDesignerResources.cs
- DebugView.cs