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
- DeviceContexts.cs
- ParameterBuilder.cs
- ApplicationContext.cs
- SchemaMerger.cs
- SqlMultiplexer.cs
- ConfigurationElementCollection.cs
- CalculatedColumn.cs
- SchemaImporter.cs
- RequestCache.cs
- NativeMethods.cs
- PrintController.cs
- UnsafeNativeMethodsCLR.cs
- Stackframe.cs
- PropertyMappingExceptionEventArgs.cs
- ModuleBuilderData.cs
- HatchBrush.cs
- DataBoundControl.cs
- httpstaticobjectscollection.cs
- _SSPIWrapper.cs
- SafeArrayRankMismatchException.cs
- SizeF.cs
- CaseStatementSlot.cs
- SignedPkcs7.cs
- StructureChangedEventArgs.cs
- SrgsOneOf.cs
- EntitySetBase.cs
- TextParagraphProperties.cs
- Section.cs
- WorkflowServiceNamespace.cs
- BitStack.cs
- FloatUtil.cs
- ListBindingHelper.cs
- SByte.cs
- FileUpload.cs
- DataGridPagerStyle.cs
- CursorConverter.cs
- WebPartConnectionsEventArgs.cs
- OutOfProcStateClientManager.cs
- TablePattern.cs
- XmlQueryTypeFactory.cs
- InternalPermissions.cs
- ReplacementText.cs
- Pair.cs
- WebPartConnectVerb.cs
- QuaternionAnimationBase.cs
- _CommandStream.cs
- cryptoapiTransform.cs
- ObjectStateFormatter.cs
- Int64AnimationBase.cs
- TransformGroup.cs
- WindowsProgressbar.cs
- InternalMappingException.cs
- SecurityDocument.cs
- StandardToolWindows.cs
- SqlDependencyListener.cs
- ButtonFieldBase.cs
- DataControlCommands.cs
- _DisconnectOverlappedAsyncResult.cs
- SortQuery.cs
- ActionNotSupportedException.cs
- hebrewshape.cs
- JsonGlobals.cs
- CodeRegionDirective.cs
- DataConnectionHelper.cs
- ExtractedStateEntry.cs
- DataColumn.cs
- RootProfilePropertySettingsCollection.cs
- ScrollEvent.cs
- CommandManager.cs
- WrappedIUnknown.cs
- DbParameterCollectionHelper.cs
- _SSPISessionCache.cs
- __FastResourceComparer.cs
- MatrixKeyFrameCollection.cs
- MarginCollapsingState.cs
- TemplateBindingExtension.cs
- XamlTypeMapper.cs
- SerializerWriterEventHandlers.cs
- TrackingSection.cs
- WebPartsPersonalization.cs
- AsyncCallback.cs
- EffectiveValueEntry.cs
- EventToken.cs
- XmlName.cs
- TreeNodeCollectionEditorDialog.cs
- MouseButtonEventArgs.cs
- TypeToStringValueConverter.cs
- COSERVERINFO.cs
- parserscommon.cs
- SrgsElementFactoryCompiler.cs
- XmlSchemaAnnotated.cs
- MetabaseSettingsIis7.cs
- SharedHttpTransportManager.cs
- ClientScriptManager.cs
- ResourcesBuildProvider.cs
- TextHintingModeValidation.cs
- RectAnimationBase.cs
- AuthenticationService.cs
- DeflateStream.cs
- HasActivatableWorkflowEvent.cs