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
- HostedController.cs
- ModuleElement.cs
- HttpClientCertificate.cs
- CodeAttachEventStatement.cs
- FunctionCommandText.cs
- AnalyzedTree.cs
- GregorianCalendarHelper.cs
- PropertyExpression.cs
- EditorZoneDesigner.cs
- cookie.cs
- SchemaImporter.cs
- TableDesigner.cs
- ClassicBorderDecorator.cs
- UIPermission.cs
- SafeNativeMethods.cs
- ResponseStream.cs
- ConfigurationStrings.cs
- ContentControl.cs
- EventSetter.cs
- ComponentFactoryHelpers.cs
- ObjectListGeneralPage.cs
- SqlColumnizer.cs
- ConstantSlot.cs
- QilUnary.cs
- ConnectivityStatus.cs
- SQLCharsStorage.cs
- SqlConnectionHelper.cs
- UiaCoreApi.cs
- Win32.cs
- DrawingGroupDrawingContext.cs
- ProcessProtocolHandler.cs
- RadioButtonFlatAdapter.cs
- ViewValidator.cs
- ModelPerspective.cs
- MimeObjectFactory.cs
- PublisherIdentityPermission.cs
- PartitionerQueryOperator.cs
- XpsResourceDictionary.cs
- GeneratedView.cs
- ClientCultureInfo.cs
- TextEndOfParagraph.cs
- GridViewPageEventArgs.cs
- SamlSubjectStatement.cs
- SqlUDTStorage.cs
- DesignTimeData.cs
- DataSourceXmlSerializationAttribute.cs
- WaitingCursor.cs
- UnsupportedPolicyOptionsException.cs
- IntegerValidator.cs
- ColumnResult.cs
- XsltOutput.cs
- HtmlInputSubmit.cs
- ResourceDescriptionAttribute.cs
- CodeObject.cs
- CodeAttachEventStatement.cs
- HealthMonitoringSection.cs
- OleDbError.cs
- ConnectionAcceptor.cs
- MissingMemberException.cs
- SaveCardRequest.cs
- InheritanceContextHelper.cs
- XPathDocumentNavigator.cs
- WebServiceEndpoint.cs
- RecipientInfo.cs
- ApplicationId.cs
- SerialErrors.cs
- DataControlFieldTypeEditor.cs
- RadioButtonDesigner.cs
- __Filters.cs
- XmlNamespaceMappingCollection.cs
- ServiceErrorHandler.cs
- SelectionListComponentEditor.cs
- XmlAttributeHolder.cs
- ActivityExecutor.cs
- SHA1.cs
- FieldBuilder.cs
- SystemMulticastIPAddressInformation.cs
- ResourceDescriptionAttribute.cs
- BitmapCodecInfoInternal.cs
- SqlNodeAnnotations.cs
- DirectoryRedirect.cs
- TypeDelegator.cs
- XmlSchemaInclude.cs
- GPPOINT.cs
- CalendarDay.cs
- WebServiceBindingAttribute.cs
- SafeFileMappingHandle.cs
- RequiredAttributeAttribute.cs
- XmlResolver.cs
- WpfSharedBamlSchemaContext.cs
- TheQuery.cs
- GraphicsContext.cs
- SchemaImporterExtensionElement.cs
- SiteMapPath.cs
- Speller.cs
- CompositionTarget.cs
- returneventsaver.cs
- EntityProxyTypeInfo.cs
- CaseKeyBox.ViewModel.cs
- Decorator.cs