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
- Section.cs
- Track.cs
- HwndHostAutomationPeer.cs
- MailSettingsSection.cs
- LingerOption.cs
- ContextMenuAutomationPeer.cs
- FlowPanelDesigner.cs
- RegistrationServices.cs
- HtmlTableCell.cs
- CurrentTimeZone.cs
- _RegBlobWebProxyDataBuilder.cs
- ListViewSelectEventArgs.cs
- DataPagerFieldCommandEventArgs.cs
- SoapIgnoreAttribute.cs
- AssemblyBuilderData.cs
- SyntaxCheck.cs
- ExecutionContext.cs
- SortDescription.cs
- InkPresenterAutomationPeer.cs
- FileInfo.cs
- TranslateTransform.cs
- QueryableDataSourceHelper.cs
- DnsEndPoint.cs
- AssemblyContextControlItem.cs
- UserNameServiceElement.cs
- SelectionBorderGlyph.cs
- XmlSchemaAppInfo.cs
- PropertyValueUIItem.cs
- StateMachineHelpers.cs
- WebPartsPersonalization.cs
- Hyperlink.cs
- BindingBase.cs
- StateManagedCollection.cs
- DataGridState.cs
- DrawingBrush.cs
- CustomError.cs
- XamlDesignerSerializationManager.cs
- SystemEvents.cs
- HtmlButton.cs
- ImageListStreamer.cs
- ICspAsymmetricAlgorithm.cs
- Compilation.cs
- ListViewUpdatedEventArgs.cs
- DataKey.cs
- BoundsDrawingContextWalker.cs
- DocumentOrderComparer.cs
- SystemNetworkInterface.cs
- RtfToken.cs
- ConfigurationErrorsException.cs
- COM2FontConverter.cs
- StylusLogic.cs
- DictionaryTraceRecord.cs
- UnsignedPublishLicense.cs
- CodeTypeParameterCollection.cs
- StylusPointPropertyId.cs
- LogAppendAsyncResult.cs
- XamlVector3DCollectionSerializer.cs
- ConvertEvent.cs
- DefaultPropertyAttribute.cs
- ResourcesBuildProvider.cs
- KeyFrames.cs
- FunctionDefinition.cs
- Int32AnimationBase.cs
- RequiredFieldValidator.cs
- ThemeDictionaryExtension.cs
- WebPartPersonalization.cs
- ErrorsHelper.cs
- ListBoxItem.cs
- ExtractorMetadata.cs
- TdsRecordBufferSetter.cs
- InstanceContext.cs
- StylusPointCollection.cs
- AnimationClockResource.cs
- ObjectDataSourceSelectingEventArgs.cs
- IndexerReference.cs
- StringOutput.cs
- JsonDataContract.cs
- ExecutedRoutedEventArgs.cs
- AccessViolationException.cs
- SqlNode.cs
- CatalogPartChrome.cs
- SortExpressionBuilder.cs
- ReversePositionQuery.cs
- EventRecord.cs
- PageWrapper.cs
- DetailsViewInsertedEventArgs.cs
- SingleTagSectionHandler.cs
- StylusPlugInCollection.cs
- _ListenerResponseStream.cs
- Image.cs
- WorkflowQueuingService.cs
- oledbmetadatacollectionnames.cs
- columnmapkeybuilder.cs
- OleServicesContext.cs
- AstNode.cs
- TypeForwardedToAttribute.cs
- ApplicationFileCodeDomTreeGenerator.cs
- HtmlEncodedRawTextWriter.cs
- StylusDownEventArgs.cs
- VisualBrush.cs