Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / AttributeQuery.cs / 1305376 / AttributeQuery.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.Globalization;
internal sealed class AttributeQuery : BaseAxisQuery {
private bool onAttribute = false;
public AttributeQuery(Query qyParent, string Name, string Prefix, XPathNodeType Type) : base(qyParent, Name, Prefix, Type) {}
private AttributeQuery(AttributeQuery other) : base(other) {
this.onAttribute = other.onAttribute;
}
public override void Reset() {
onAttribute = false;
base.Reset();
}
public override XPathNavigator Advance() {
while (true) {
if (! onAttribute) {
currentNode = qyInput.Advance();
if (currentNode == null) {
return null;
}
position = 0;
currentNode = currentNode.Clone();
onAttribute = currentNode.MoveToFirstAttribute();
} else {
onAttribute = currentNode.MoveToNextAttribute();
}
if (onAttribute) {
Debug.Assert(! currentNode.NamespaceURI.Equals(XmlReservedNs.NsXmlNs));
if (matches(currentNode)) {
position++;
return currentNode;
}
}
} // while
}
public override XPathNavigator MatchNode(XPathNavigator context) {
if (context != null) {
if (context.NodeType == XPathNodeType.Attribute && matches(context)) {
XPathNavigator temp = context.Clone();
if (temp.MoveToParent()) {
return qyInput.MatchNode(temp);
}
}
}
return null;
}
public override XPathNodeIterator Clone() { return new AttributeQuery(this); }
}
}
// 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.Globalization;
internal sealed class AttributeQuery : BaseAxisQuery {
private bool onAttribute = false;
public AttributeQuery(Query qyParent, string Name, string Prefix, XPathNodeType Type) : base(qyParent, Name, Prefix, Type) {}
private AttributeQuery(AttributeQuery other) : base(other) {
this.onAttribute = other.onAttribute;
}
public override void Reset() {
onAttribute = false;
base.Reset();
}
public override XPathNavigator Advance() {
while (true) {
if (! onAttribute) {
currentNode = qyInput.Advance();
if (currentNode == null) {
return null;
}
position = 0;
currentNode = currentNode.Clone();
onAttribute = currentNode.MoveToFirstAttribute();
} else {
onAttribute = currentNode.MoveToNextAttribute();
}
if (onAttribute) {
Debug.Assert(! currentNode.NamespaceURI.Equals(XmlReservedNs.NsXmlNs));
if (matches(currentNode)) {
position++;
return currentNode;
}
}
} // while
}
public override XPathNavigator MatchNode(XPathNavigator context) {
if (context != null) {
if (context.NodeType == XPathNodeType.Attribute && matches(context)) {
XPathNavigator temp = context.Clone();
if (temp.MoveToParent()) {
return qyInput.MatchNode(temp);
}
}
}
return null;
}
public override XPathNodeIterator Clone() { return new AttributeQuery(this); }
}
}
// 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
- PageContent.cs
- PersistChildrenAttribute.cs
- TextDecoration.cs
- XmlReaderDelegator.cs
- ProfileSettings.cs
- PostBackTrigger.cs
- XmlSerializerVersionAttribute.cs
- DispatcherFrame.cs
- ListViewHitTestInfo.cs
- SID.cs
- CurrencyManager.cs
- Rule.cs
- VoiceSynthesis.cs
- ColumnResizeUndoUnit.cs
- DocumentPageView.cs
- CompilerCollection.cs
- EditorBrowsableAttribute.cs
- FuncCompletionCallbackWrapper.cs
- SoundPlayer.cs
- DataGridPagerStyle.cs
- BuildManagerHost.cs
- UnsafeNativeMethods.cs
- Tracking.cs
- InvokeMethod.cs
- InvokeBase.cs
- UrlMappingsModule.cs
- LongAverageAggregationOperator.cs
- DocComment.cs
- TrackingExtract.cs
- ScriptMethodAttribute.cs
- BaseEntityWrapper.cs
- HighContrastHelper.cs
- BooleanProjectedSlot.cs
- WriteTimeStream.cs
- webclient.cs
- DirectoryInfo.cs
- ReceiveActivityValidator.cs
- EventRouteFactory.cs
- HotCommands.cs
- BindingUtils.cs
- Win32KeyboardDevice.cs
- XmlSerializerVersionAttribute.cs
- connectionpool.cs
- SystemTcpStatistics.cs
- XmlValidatingReaderImpl.cs
- Mutex.cs
- BufferBuilder.cs
- LinkButton.cs
- _FixedSizeReader.cs
- DbConnectionStringCommon.cs
- PropertyPathWorker.cs
- PropertyEmitter.cs
- CodeParameterDeclarationExpressionCollection.cs
- StreamUpgradeBindingElement.cs
- WebPartDescriptionCollection.cs
- OutOfProcStateClientManager.cs
- JoinGraph.cs
- ListViewGroupConverter.cs
- TreeNodeCollection.cs
- WebPartsPersonalization.cs
- SerializationBinder.cs
- XmlAtomicValue.cs
- ChangePasswordDesigner.cs
- SqlUDTStorage.cs
- SplineKeyFrames.cs
- IsolatedStorageFile.cs
- InternalPolicyElement.cs
- TypefaceCollection.cs
- ExpressionQuoter.cs
- Compiler.cs
- TextServicesCompartment.cs
- TextContainerChangedEventArgs.cs
- dbenumerator.cs
- TextMessageEncodingElement.cs
- PropertyGridView.cs
- Util.cs
- ArrangedElementCollection.cs
- mactripleDES.cs
- RuleCache.cs
- QilReference.cs
- DbProviderServices.cs
- SrgsGrammar.cs
- PointConverter.cs
- ProviderCommandInfoUtils.cs
- AutoResizedEvent.cs
- RangeValuePatternIdentifiers.cs
- ServicePoint.cs
- FixedTextContainer.cs
- DesignerTextBoxAdapter.cs
- OutputCache.cs
- ToolStripContainer.cs
- XmlDocumentSurrogate.cs
- DecimalAnimationUsingKeyFrames.cs
- Color.cs
- ExtendedTransformFactory.cs
- InstanceKey.cs
- MsmqIntegrationReceiveParameters.cs
- AuthenticodeSignatureInformation.cs
- HyperLinkStyle.cs
- FixedPageStructure.cs