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
- TransformFinalBlockRequest.cs
- XPathDescendantIterator.cs
- DataServiceException.cs
- LinkedResource.cs
- Hyperlink.cs
- followingquery.cs
- MatrixAnimationUsingPath.cs
- ListBindingHelper.cs
- TogglePattern.cs
- RelatedView.cs
- FolderLevelBuildProvider.cs
- OneWayChannelFactory.cs
- Operator.cs
- CachedFontFace.cs
- Vector3DAnimationBase.cs
- PenLineJoinValidation.cs
- SerializationEventsCache.cs
- XamlWriterExtensions.cs
- TextSpan.cs
- LoginAutoFormat.cs
- PublisherIdentityPermission.cs
- CachedPathData.cs
- MenuAdapter.cs
- PersistenceContextEnlistment.cs
- IndentedWriter.cs
- EntryPointNotFoundException.cs
- PnrpPermission.cs
- CriticalExceptions.cs
- ToolStripDesignerAvailabilityAttribute.cs
- SystemColorTracker.cs
- DiagnosticEventProvider.cs
- DbConnectionHelper.cs
- Win32Native.cs
- StreamSecurityUpgradeAcceptor.cs
- FileRegion.cs
- AssociationEndMember.cs
- XmlAttributeCollection.cs
- AnnotationResourceCollection.cs
- HtmlInputText.cs
- CalendarModeChangedEventArgs.cs
- ScriptingSectionGroup.cs
- DataControlPagerLinkButton.cs
- InstancePersistenceException.cs
- StructuralComparisons.cs
- ObjectSet.cs
- LinkButton.cs
- Timeline.cs
- TemplatedAdorner.cs
- VectorCollection.cs
- LoginAutoFormat.cs
- PropertyInformationCollection.cs
- Int64Converter.cs
- CqlIdentifiers.cs
- CaseExpr.cs
- CompilationLock.cs
- ListenerHandler.cs
- ConfigXmlSignificantWhitespace.cs
- ScriptMethodAttribute.cs
- OutputScopeManager.cs
- PolyLineSegmentFigureLogic.cs
- PnrpPeerResolver.cs
- ScrollContentPresenter.cs
- GridViewUpdatedEventArgs.cs
- __TransparentProxy.cs
- NoClickablePointException.cs
- ExpressionPrefixAttribute.cs
- SqlDataSourceFilteringEventArgs.cs
- SerialReceived.cs
- PerformanceCounterCategory.cs
- SqlConnectionFactory.cs
- SamlSecurityToken.cs
- StorageComplexPropertyMapping.cs
- StrokeFIndices.cs
- InputBindingCollection.cs
- StorageTypeMapping.cs
- CodeCommentStatement.cs
- PrinterResolution.cs
- FlowDocumentReaderAutomationPeer.cs
- TrackingQueryElement.cs
- BitmapFrameEncode.cs
- KnownBoxes.cs
- EventProviderWriter.cs
- graph.cs
- Rectangle.cs
- MetadataArtifactLoaderFile.cs
- _FtpControlStream.cs
- BooleanFunctions.cs
- ElementNotEnabledException.cs
- ObjectDataSourceStatusEventArgs.cs
- BulletChrome.cs
- FamilyMap.cs
- DbConnectionPoolCounters.cs
- RuleSettingsCollection.cs
- WorkflowInstanceQuery.cs
- TimeIntervalCollection.cs
- UInt16Converter.cs
- VectorAnimationBase.cs
- Classification.cs
- FrameworkTemplate.cs
- LongMinMaxAggregationOperator.cs