Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Xml / System / Xml / XPath / Internal / AttributeQuery.cs / 1 / 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
- BinaryKeyIdentifierClause.cs
- SQLBinaryStorage.cs
- LinkDescriptor.cs
- ProbeMatchesCD1.cs
- CollectionDataContract.cs
- UriTemplateMatch.cs
- Table.cs
- ThaiBuddhistCalendar.cs
- WebPartManager.cs
- DateRangeEvent.cs
- Number.cs
- PolicyReader.cs
- Menu.cs
- ContractReference.cs
- WmiEventSink.cs
- CredentialCache.cs
- ClientBuildManager.cs
- Validator.cs
- SimpleWebHandlerParser.cs
- Bold.cs
- DataGridColumnHeader.cs
- MembershipValidatePasswordEventArgs.cs
- IisHelper.cs
- DesignerTransactionCloseEvent.cs
- TableParagraph.cs
- PageThemeBuildProvider.cs
- DefaultValueTypeConverter.cs
- CompilerTypeWithParams.cs
- HtmlInputCheckBox.cs
- WorkItem.cs
- QuaternionConverter.cs
- HashCryptoHandle.cs
- LinqDataSourceSelectEventArgs.cs
- WebResourceUtil.cs
- ReflectionTypeLoadException.cs
- IFlowDocumentViewer.cs
- DataGridViewColumnTypeEditor.cs
- ErrorFormatterPage.cs
- validationstate.cs
- URLString.cs
- WizardPanel.cs
- OracleInfoMessageEventArgs.cs
- HyperLink.cs
- OpenTypeCommon.cs
- WebServiceAttribute.cs
- TextEffect.cs
- SmtpFailedRecipientException.cs
- DockingAttribute.cs
- WebConfigurationManager.cs
- ApplicationException.cs
- TextBounds.cs
- ArrayConverter.cs
- MemberDomainMap.cs
- MobileControlsSectionHelper.cs
- TypeDependencyAttribute.cs
- ReadonlyMessageFilter.cs
- DebugController.cs
- BindingWorker.cs
- PerformanceCounterPermissionEntry.cs
- SqlProfileProvider.cs
- ActivityTrace.cs
- ChannelBase.cs
- DependencyPropertyConverter.cs
- ADRoleFactory.cs
- CodeCatchClauseCollection.cs
- WorkflowQueue.cs
- TypeConstant.cs
- FilterEventArgs.cs
- Transform3DGroup.cs
- TryCatchDesigner.xaml.cs
- Effect.cs
- Brush.cs
- MarkerProperties.cs
- ParallelActivityDesigner.cs
- NamedPipeAppDomainProtocolHandler.cs
- FormatConvertedBitmap.cs
- CalendarDateRangeChangingEventArgs.cs
- XmlAnyAttributeAttribute.cs
- OdbcConnection.cs
- EventMappingSettings.cs
- ColumnHeader.cs
- UserControlCodeDomTreeGenerator.cs
- TreeNodeEventArgs.cs
- EdmPropertyAttribute.cs
- UshortList2.cs
- TreeViewDesigner.cs
- XPathNodeList.cs
- XmlStrings.cs
- Point3DCollection.cs
- OdbcConnection.cs
- PriorityQueue.cs
- PrimitiveXmlSerializers.cs
- safex509handles.cs
- HtmlTextArea.cs
- CompilerLocalReference.cs
- Validator.cs
- InstanceOwner.cs
- CodeAttributeArgumentCollection.cs
- HandlerFactoryCache.cs
- QueryResponse.cs