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
- WinEventTracker.cs
- NullableDecimalAverageAggregationOperator.cs
- XmlEntityReference.cs
- WrappedIUnknown.cs
- IndexOutOfRangeException.cs
- FrameworkElementFactoryMarkupObject.cs
- InputQueue.cs
- EnumValidator.cs
- Stacktrace.cs
- ScriptComponentDescriptor.cs
- ObjectListCommandCollection.cs
- TextOnlyOutput.cs
- BamlCollectionHolder.cs
- TableCellCollection.cs
- PathFigure.cs
- PointLight.cs
- AccessDataSourceWizardForm.cs
- ValidationRuleCollection.cs
- URIFormatException.cs
- RequiredFieldValidator.cs
- TimeSpanOrInfiniteConverter.cs
- BindingSource.cs
- DeviceContext.cs
- SponsorHelper.cs
- LogManagementAsyncResult.cs
- CssStyleCollection.cs
- Knowncolors.cs
- SafeFindHandle.cs
- AssemblyBuilder.cs
- DesignBindingConverter.cs
- ToolStripSeparatorRenderEventArgs.cs
- InstanceValue.cs
- ApplicationCommands.cs
- NetworkInterface.cs
- DoWorkEventArgs.cs
- IndicCharClassifier.cs
- EntityDataReader.cs
- SettingsPropertyValueCollection.cs
- CheckBoxFlatAdapter.cs
- CustomAttributeSerializer.cs
- DocumentViewerBase.cs
- EntityConnectionStringBuilder.cs
- ParallelTimeline.cs
- DrawingContextDrawingContextWalker.cs
- PointConverter.cs
- Dump.cs
- SessionPageStatePersister.cs
- ReadWriteSpinLock.cs
- EncryptedPackageFilter.cs
- HealthMonitoringSectionHelper.cs
- OutgoingWebRequestContext.cs
- ViewEventArgs.cs
- __FastResourceComparer.cs
- SafeLibraryHandle.cs
- MutableAssemblyCacheEntry.cs
- Registry.cs
- DataGridRowAutomationPeer.cs
- LayoutDump.cs
- TraceLog.cs
- DataSourceGroupCollection.cs
- MsmqTransportElement.cs
- SQLByte.cs
- FacetValues.cs
- Int32CAMarshaler.cs
- TypedElement.cs
- CodeIndexerExpression.cs
- TypeSystemProvider.cs
- DataColumnMappingCollection.cs
- DataFormats.cs
- ResourceBinder.cs
- nulltextcontainer.cs
- GeneralTransform3DGroup.cs
- LabelLiteral.cs
- RegistryPermission.cs
- SelectorItemAutomationPeer.cs
- FormatVersion.cs
- SiteMembershipCondition.cs
- BaseUriHelper.cs
- QueryStatement.cs
- AdjustableArrowCap.cs
- DataSourceCache.cs
- BaseAddressElementCollection.cs
- WebPartConnectionsCancelVerb.cs
- HttpCapabilitiesBase.cs
- DesignerWebPartChrome.cs
- DispatcherTimer.cs
- StructuredTypeEmitter.cs
- CodeTypeReference.cs
- ComPlusThreadInitializer.cs
- Cursor.cs
- MatrixAnimationUsingKeyFrames.cs
- AssemblyResourceLoader.cs
- SemanticKeyElement.cs
- OrderedDictionary.cs
- SchemaConstraints.cs
- AsyncPostBackErrorEventArgs.cs
- TabRenderer.cs
- MulticastDelegate.cs
- ClrProviderManifest.cs
- RuleInfoComparer.cs