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
- ConnectionPointGlyph.cs
- AVElementHelper.cs
- RegionIterator.cs
- ResizeGrip.cs
- Rotation3DAnimationBase.cs
- ArcSegment.cs
- ConnectionInterfaceCollection.cs
- WinFormsSpinner.cs
- SeekableMessageNavigator.cs
- PersonalizationEntry.cs
- WebConfigurationManager.cs
- EdmItemError.cs
- TextSegment.cs
- ToolStripArrowRenderEventArgs.cs
- GenericXmlSecurityToken.cs
- ObjectMemberMapping.cs
- XPathItem.cs
- PageSettings.cs
- FloaterParaClient.cs
- Grid.cs
- GridViewEditEventArgs.cs
- ListBox.cs
- System.Data_BID.cs
- XmlSchemaAnnotation.cs
- SchemaTypeEmitter.cs
- MarkupWriter.cs
- DataGridColumnCollection.cs
- DataGridParentRows.cs
- ReturnEventArgs.cs
- ListItemViewAttribute.cs
- SQLDateTime.cs
- CornerRadiusConverter.cs
- PartialTrustHelpers.cs
- nulltextcontainer.cs
- ConfigXmlText.cs
- ErrorReporting.cs
- Propagator.JoinPropagator.cs
- Stopwatch.cs
- SessionStateContainer.cs
- TextUtf8RawTextWriter.cs
- WebPartsPersonalization.cs
- DataGridViewCellStyleConverter.cs
- StateDesigner.TransitionInfo.cs
- RtfFormatStack.cs
- ReadOnlyAttribute.cs
- ADMembershipProvider.cs
- TabItem.cs
- PasswordTextContainer.cs
- AnonymousIdentificationSection.cs
- XamlToRtfParser.cs
- __TransparentProxy.cs
- DataContractSerializerElement.cs
- DataViewManagerListItemTypeDescriptor.cs
- ProcessModelSection.cs
- TextBoxBaseDesigner.cs
- TextElementEnumerator.cs
- PanelStyle.cs
- DataServiceKeyAttribute.cs
- TextEditorMouse.cs
- XmlSchemaSimpleTypeRestriction.cs
- mda.cs
- RSAPKCS1KeyExchangeFormatter.cs
- MouseCaptureWithinProperty.cs
- CalendarDay.cs
- AnnotationObservableCollection.cs
- FixedFindEngine.cs
- Path.cs
- UserThread.cs
- TextBoxView.cs
- XmlDataSourceNodeDescriptor.cs
- XmlSyndicationContent.cs
- BuildManagerHost.cs
- StrongBox.cs
- ReadOnlyCollectionBase.cs
- ParentQuery.cs
- DataSourceCacheDurationConverter.cs
- EventLogConfiguration.cs
- SqlDataSourceCustomCommandEditor.cs
- IDQuery.cs
- ReaderWriterLockWrapper.cs
- InvalidPrinterException.cs
- ListViewHitTestInfo.cs
- WriteableBitmap.cs
- Tuple.cs
- AssemblyResolver.cs
- ZoneIdentityPermission.cs
- DataControlFieldTypeEditor.cs
- WorkflowApplicationCompletedException.cs
- NullableConverter.cs
- KerberosRequestorSecurityTokenAuthenticator.cs
- SystemThemeKey.cs
- ComponentCommands.cs
- LayoutTable.cs
- BufferedOutputStream.cs
- LayoutTable.cs
- _ContextAwareResult.cs
- TrackingProfileCache.cs
- WsatAdminException.cs
- XmlExceptionHelper.cs
- FontFaceLayoutInfo.cs