Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- MultiSelector.cs
- ColorKeyFrameCollection.cs
- TemplateApplicationHelper.cs
- Number.cs
- MarkupWriter.cs
- RsaSecurityToken.cs
- WaitHandleCannotBeOpenedException.cs
- FragmentNavigationEventArgs.cs
- FontNamesConverter.cs
- InvalidPropValue.cs
- CryptoApi.cs
- IntegrationExceptionEventArgs.cs
- ExcCanonicalXml.cs
- WebPartVerbCollection.cs
- ProvideValueServiceProvider.cs
- PageFunction.cs
- FontSizeConverter.cs
- DateBoldEvent.cs
- SerializationFieldInfo.cs
- PageBreakRecord.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- DataGridBoolColumn.cs
- WaitForChangedResult.cs
- ConnectionPool.cs
- HttpServerVarsCollection.cs
- DesignerActionUIService.cs
- mediaeventshelper.cs
- FaultImportOptions.cs
- HtmlShimManager.cs
- _SecureChannel.cs
- XMLSyntaxException.cs
- DataGridViewRowsRemovedEventArgs.cs
- RuleInfoComparer.cs
- FunctionNode.cs
- ProfileEventArgs.cs
- ObjectResult.cs
- XmlSerializableReader.cs
- UserControlBuildProvider.cs
- Matrix.cs
- shaperfactoryquerycacheentry.cs
- TableItemStyle.cs
- PresentationAppDomainManager.cs
- LongTypeConverter.cs
- Signature.cs
- CallbackException.cs
- XmlComplianceUtil.cs
- ToolboxSnapDragDropEventArgs.cs
- UrlAuthFailedErrorFormatter.cs
- TokenBasedSet.cs
- DSASignatureDeformatter.cs
- WebPartConnectionsCancelVerb.cs
- EventRecordWrittenEventArgs.cs
- IDReferencePropertyAttribute.cs
- AffineTransform3D.cs
- DbParameterCollectionHelper.cs
- PublisherIdentityPermission.cs
- BitmapSizeOptions.cs
- ProgressPage.cs
- SystemEvents.cs
- TextProperties.cs
- recordstatescratchpad.cs
- Viewport3DAutomationPeer.cs
- MappingItemCollection.cs
- X509ThumbprintKeyIdentifierClause.cs
- MultipartIdentifier.cs
- BamlTreeUpdater.cs
- ColumnCollection.cs
- GlobalProxySelection.cs
- PrinterSettings.cs
- Application.cs
- TraceLog.cs
- SharedStatics.cs
- Rotation3DAnimation.cs
- CheckBoxPopupAdapter.cs
- ContentElementAutomationPeer.cs
- MatcherBuilder.cs
- SelectionUIHandler.cs
- TextCharacters.cs
- ToolBarButton.cs
- XmlTextReader.cs
- OrthographicCamera.cs
- Binding.cs
- ContextBase.cs
- PerfCounterSection.cs
- updatecommandorderer.cs
- PropertyChangingEventArgs.cs
- ValidationEventArgs.cs
- ADMembershipUser.cs
- OutputCacheProfileCollection.cs
- ClosableStream.cs
- DataStorage.cs
- InputBinding.cs
- MaterialGroup.cs
- TableHeaderCell.cs
- DataSetMappper.cs
- IncomingWebResponseContext.cs
- BindingCompleteEventArgs.cs
- ContextMenuStripGroupCollection.cs
- BCLDebug.cs
- DataGridBoolColumn.cs