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
- ResourceCollectionInfo.cs
- StreamGeometryContext.cs
- ConfigurationSettings.cs
- DataSetMappper.cs
- RuntimeUtils.cs
- AdornerLayer.cs
- InlineUIContainer.cs
- SafeNativeMethods.cs
- OleDbReferenceCollection.cs
- DockPanel.cs
- SystemColors.cs
- IdentityManager.cs
- SqlFileStream.cs
- WsiProfilesElement.cs
- MultiByteCodec.cs
- XamlPoint3DCollectionSerializer.cs
- ObjectListSelectEventArgs.cs
- GZipStream.cs
- ImageUrlEditor.cs
- FormClosedEvent.cs
- SymbolTable.cs
- ManagedFilter.cs
- Point3DAnimationUsingKeyFrames.cs
- BuildResultCache.cs
- FacetValues.cs
- KeyInterop.cs
- DivideByZeroException.cs
- BoundingRectTracker.cs
- WebRequestModuleElementCollection.cs
- _SslSessionsCache.cs
- SessionParameter.cs
- FactoryRecord.cs
- TrustLevel.cs
- SiteMapProvider.cs
- GPPOINTF.cs
- CodeDomLocalizationProvider.cs
- TextServicesProperty.cs
- RuntimeHelpers.cs
- SchemaImporterExtension.cs
- DesignerCommandAdapter.cs
- PauseStoryboard.cs
- storepermission.cs
- xmlNames.cs
- DrawingAttributeSerializer.cs
- ObjectDataSource.cs
- WindowsTokenRoleProvider.cs
- FileNotFoundException.cs
- TreeNodeStyleCollection.cs
- ZoneLinkButton.cs
- ThaiBuddhistCalendar.cs
- AppModelKnownContentFactory.cs
- HwndStylusInputProvider.cs
- ThreadLocal.cs
- SignatureToken.cs
- SimpleBitVector32.cs
- ExpressionBindingCollection.cs
- ResourceReferenceExpression.cs
- ParallelTimeline.cs
- AutomationEventArgs.cs
- RawTextInputReport.cs
- EpmContentSerializer.cs
- ConfigXmlAttribute.cs
- AsnEncodedData.cs
- ViewStateModeByIdAttribute.cs
- DiscoveryUtility.cs
- Rules.cs
- SQLInt32.cs
- TypeDependencyAttribute.cs
- CompensatableTransactionScopeActivityDesigner.cs
- ServiceReference.cs
- DataServiceHostFactory.cs
- Int16Animation.cs
- FocusWithinProperty.cs
- XamlReaderHelper.cs
- SessionViewState.cs
- WebPartMinimizeVerb.cs
- Geometry.cs
- EdmProperty.cs
- IdleTimeoutMonitor.cs
- ItemCheckEvent.cs
- ToolStripDropDownMenu.cs
- DebugView.cs
- SoapAttributes.cs
- MouseBinding.cs
- URLEditor.cs
- DocumentEventArgs.cs
- TransformPattern.cs
- TransportOutputChannel.cs
- DSACryptoServiceProvider.cs
- InlineObject.cs
- BrowsableAttribute.cs
- DataSourceUtil.cs
- ComponentChangedEvent.cs
- DataGridViewCellValueEventArgs.cs
- ProgressBarAutomationPeer.cs
- ExpandoObject.cs
- MenuItem.cs
- DefaultIfEmptyQueryOperator.cs
- WindowsContainer.cs
- MachineKeySection.cs