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
- EntityStoreSchemaFilterEntry.cs
- ConnectionManagementElement.cs
- RegexStringValidatorAttribute.cs
- CodeMethodReturnStatement.cs
- WindowVisualStateTracker.cs
- UnsafeNativeMethods.cs
- ColorPalette.cs
- CacheRequest.cs
- DrawingContextDrawingContextWalker.cs
- XMLSyntaxException.cs
- URLString.cs
- CodeGenerationManager.cs
- ContentHostHelper.cs
- AppDomain.cs
- EmptyQuery.cs
- SqlPersonalizationProvider.cs
- DataGridComponentEditor.cs
- TableLayout.cs
- PackagePartCollection.cs
- SecurityCriticalDataForSet.cs
- StateMachineSubscription.cs
- TextTabProperties.cs
- DataGrid.cs
- RelationshipSet.cs
- CodeVariableReferenceExpression.cs
- IndentedWriter.cs
- SafeNativeMethodsOther.cs
- EditorZoneBase.cs
- ListViewCancelEventArgs.cs
- XmlSchemaRedefine.cs
- FrameAutomationPeer.cs
- SHA1CryptoServiceProvider.cs
- NameGenerator.cs
- HyperlinkAutomationPeer.cs
- StreamAsIStream.cs
- MsmqReceiveHelper.cs
- PerformanceCounterManager.cs
- ListBox.cs
- AlternationConverter.cs
- RepeaterItemEventArgs.cs
- TreeNodeSelectionProcessor.cs
- EffectiveValueEntry.cs
- RectConverter.cs
- ScrollEvent.cs
- Automation.cs
- FSWPathEditor.cs
- RichTextBoxConstants.cs
- ChannelManager.cs
- CustomValidator.cs
- TabItemWrapperAutomationPeer.cs
- DesignerEventService.cs
- ControlValuePropertyAttribute.cs
- localization.cs
- ConfigXmlComment.cs
- WebPartManager.cs
- Evaluator.cs
- AudioFormatConverter.cs
- CatalogPartChrome.cs
- GridSplitterAutomationPeer.cs
- ValueProviderWrapper.cs
- DisplayMemberTemplateSelector.cs
- EventData.cs
- ControlDesigner.cs
- NavigationFailedEventArgs.cs
- FaultCode.cs
- MetadataCollection.cs
- XmlConverter.cs
- TrustManagerPromptUI.cs
- CompiledQuery.cs
- HebrewCalendar.cs
- NamespaceQuery.cs
- X509ChainPolicy.cs
- HtmlShimManager.cs
- SystemEvents.cs
- ScriptResourceHandler.cs
- CustomLineCap.cs
- InputScopeAttribute.cs
- CodeCompiler.cs
- ZoomingMessageFilter.cs
- FormViewRow.cs
- TemplateBindingExtensionConverter.cs
- EdmSchemaError.cs
- NavigationExpr.cs
- DiscreteKeyFrames.cs
- wgx_sdk_version.cs
- SystemResources.cs
- ObjectStateEntry.cs
- IPGlobalProperties.cs
- Quaternion.cs
- JournalEntryListConverter.cs
- Enumerable.cs
- DebuggerService.cs
- SystemSounds.cs
- storepermission.cs
- InputBinder.cs
- Opcode.cs
- PageContentCollection.cs
- CultureNotFoundException.cs
- SqlUtil.cs
- TraceEventCache.cs