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
![Network programming in C#, Network Programming in VB.NET, Network Programming in .NET](/images/book.jpg)
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- StylusButton.cs
- WebBrowserUriTypeConverter.cs
- DecimalConstantAttribute.cs
- FieldToken.cs
- CommandManager.cs
- _DigestClient.cs
- VirtualDirectoryMappingCollection.cs
- SafeEventHandle.cs
- ExceptionHandlers.cs
- XPSSignatureDefinition.cs
- ToggleButtonAutomationPeer.cs
- SqlCommandBuilder.cs
- ContextBase.cs
- DbConnectionPoolCounters.cs
- UInt16.cs
- DescendantOverDescendantQuery.cs
- FaultFormatter.cs
- TextPattern.cs
- SQLSingle.cs
- XmlSequenceWriter.cs
- WindowsHyperlink.cs
- FixUpCollection.cs
- RecognizerStateChangedEventArgs.cs
- OpenTypeCommon.cs
- UnmanagedMarshal.cs
- UriParserTemplates.cs
- ToolStripDesignerAvailabilityAttribute.cs
- ViewManager.cs
- CellTreeSimplifier.cs
- TemplateBuilder.cs
- DeadCharTextComposition.cs
- FixedSOMImage.cs
- DockPanel.cs
- ToolboxItemCollection.cs
- CTreeGenerator.cs
- Transform3D.cs
- AttributeConverter.cs
- basenumberconverter.cs
- BindingContext.cs
- GridViewPageEventArgs.cs
- SmiEventSink.cs
- VoiceChangeEventArgs.cs
- CacheSection.cs
- UdpDiscoveryMessageFilter.cs
- FormViewDeleteEventArgs.cs
- BezierSegment.cs
- BindStream.cs
- CompositeDuplexBindingElementImporter.cs
- CalendarDateChangedEventArgs.cs
- Quad.cs
- BitmapImage.cs
- InstanceDescriptor.cs
- DataChangedEventManager.cs
- BridgeDataReader.cs
- SettingsPropertyWrongTypeException.cs
- WpfWebRequestHelper.cs
- EventListener.cs
- MimeMultiPart.cs
- Geometry3D.cs
- ObsoleteAttribute.cs
- DrawingVisual.cs
- SpotLight.cs
- XmlTextWriter.cs
- CompensatableTransactionScopeActivity.cs
- Byte.cs
- GridViewUpdatedEventArgs.cs
- TableLayoutCellPaintEventArgs.cs
- IntegerValidatorAttribute.cs
- StateItem.cs
- CompilationAssemblyInstallComponent.cs
- DetailsViewPagerRow.cs
- ToolboxItemFilterAttribute.cs
- TaiwanLunisolarCalendar.cs
- CaseInsensitiveComparer.cs
- TimeSpanConverter.cs
- ToolStripLocationCancelEventArgs.cs
- COAUTHIDENTITY.cs
- TextSelectionHelper.cs
- HtmlControlPersistable.cs
- DisplayNameAttribute.cs
- BigInt.cs
- DesignerActionItemCollection.cs
- Geometry3D.cs
- DESCryptoServiceProvider.cs
- AxisAngleRotation3D.cs
- bidPrivateBase.cs
- UriTemplateClientFormatter.cs
- XmlSchemaObjectCollection.cs
- XmlMemberMapping.cs
- KeyGesture.cs
- RenameRuleObjectDialog.Designer.cs
- DBCSCodePageEncoding.cs
- CommandBindingCollection.cs
- KeyPressEvent.cs
- StringArrayConverter.cs
- figurelengthconverter.cs
- RoutedUICommand.cs
- ManagedFilter.cs
- ToolBarPanel.cs
- Permission.cs