Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- UnsafeNativeMethods.cs
- MethodBuilderInstantiation.cs
- Binding.cs
- IisTraceListener.cs
- UICuesEvent.cs
- CategoryEditor.cs
- XPathNavigatorReader.cs
- PropertyExpression.cs
- Update.cs
- SelectorItemAutomationPeer.cs
- SimpleRecyclingCache.cs
- SortAction.cs
- FlowLayoutPanel.cs
- MobileTemplatedControlDesigner.cs
- PropertyTab.cs
- LassoSelectionBehavior.cs
- ContextMenu.cs
- Repeater.cs
- QilTargetType.cs
- DataGridViewRowsRemovedEventArgs.cs
- ToolStripLabel.cs
- AccessDataSource.cs
- InvalidCastException.cs
- MarshalByRefObject.cs
- ThreadStateException.cs
- LinearGradientBrush.cs
- ResolveNameEventArgs.cs
- BitmapPalette.cs
- PenCursorManager.cs
- CollectionViewProxy.cs
- SoapObjectWriter.cs
- FixedFlowMap.cs
- TraceContextEventArgs.cs
- GridEntry.cs
- DbExpressionRules.cs
- SpecialNameAttribute.cs
- PerformanceCounterLib.cs
- TimerEventSubscription.cs
- WebSysDefaultValueAttribute.cs
- AutomationPattern.cs
- NullReferenceException.cs
- DecimalConverter.cs
- OneOf.cs
- DataGridPageChangedEventArgs.cs
- FieldTemplateUserControl.cs
- SpotLight.cs
- BufferedOutputAsyncStream.cs
- _SecureChannel.cs
- ScriptRegistrationManager.cs
- CodeVariableDeclarationStatement.cs
- RootProfilePropertySettingsCollection.cs
- TextWriterTraceListener.cs
- MetafileHeader.cs
- ParallelEnumerable.cs
- HelpFileFileNameEditor.cs
- MissingFieldException.cs
- ControlEvent.cs
- WebBrowserHelper.cs
- WebBrowserSiteBase.cs
- LineServicesRun.cs
- CqlIdentifiers.cs
- PrintDocument.cs
- SplitterCancelEvent.cs
- XmlSignatureManifest.cs
- TableLayoutPanelCodeDomSerializer.cs
- BitmapSourceSafeMILHandle.cs
- FilterableAttribute.cs
- TextElementEnumerator.cs
- ObjectDataSourceMethodEventArgs.cs
- WindowAutomationPeer.cs
- DragStartedEventArgs.cs
- MenuItem.cs
- Utility.cs
- BitmapMetadataEnumerator.cs
- ValueUtilsSmi.cs
- MessageContractAttribute.cs
- SoapRpcMethodAttribute.cs
- LocalizableResourceBuilder.cs
- InvalidDataException.cs
- MsdtcWrapper.cs
- ToggleProviderWrapper.cs
- QilStrConcatenator.cs
- LinqDataSourceUpdateEventArgs.cs
- CharAnimationUsingKeyFrames.cs
- FeatureManager.cs
- SubMenuStyleCollection.cs
- MailFileEditor.cs
- TextFormatterContext.cs
- CompoundFileReference.cs
- MetadataArtifactLoaderFile.cs
- WebPartAddingEventArgs.cs
- ConstructorNeedsTagAttribute.cs
- LongValidator.cs
- mediaclock.cs
- XamlPathDataSerializer.cs
- PackWebRequest.cs
- XPathDocumentBuilder.cs
- XmlDataSourceNodeDescriptor.cs
- CharacterString.cs
- ThemeConfigurationDialog.cs