Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / 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
- HijriCalendar.cs
- RouteData.cs
- UnsafeNativeMethods.cs
- DataListItemCollection.cs
- SessionEndingEventArgs.cs
- DataPointer.cs
- UnsafeNativeMethods.cs
- SqlGenerator.cs
- HiddenFieldDesigner.cs
- SafeRightsManagementPubHandle.cs
- ServiceNameElement.cs
- XmlSchemaSubstitutionGroup.cs
- GuidelineCollection.cs
- ToolStripTextBox.cs
- ConnectionConsumerAttribute.cs
- DataStorage.cs
- _HeaderInfo.cs
- AttributeEmitter.cs
- safex509handles.cs
- FormatterConverter.cs
- WebPartZoneCollection.cs
- EntityDataSourceView.cs
- SemaphoreSlim.cs
- XmlNamespaceManager.cs
- DataSourceHelper.cs
- ItemsPresenter.cs
- EncryptedKey.cs
- TextPointer.cs
- SerializationInfoEnumerator.cs
- ConstraintManager.cs
- XPathException.cs
- Proxy.cs
- XamlSerializer.cs
- URI.cs
- RijndaelManagedTransform.cs
- SortKey.cs
- BinaryNode.cs
- TextContainerHelper.cs
- ExcCanonicalXml.cs
- VoiceSynthesis.cs
- EtwTrace.cs
- AnnotationStore.cs
- StreamGeometry.cs
- COM2ColorConverter.cs
- ModifierKeysValueSerializer.cs
- SecurityUtils.cs
- HttpValueCollection.cs
- SymLanguageType.cs
- LocalizationParserHooks.cs
- JsonUriDataContract.cs
- ListControlActionList.cs
- VisualStyleElement.cs
- PixelShader.cs
- ExtensionDataReader.cs
- DelegatedStream.cs
- StreamDocument.cs
- DataRowView.cs
- PersonalizablePropertyEntry.cs
- PerformanceCounterLib.cs
- MetadataAssemblyHelper.cs
- LayoutEditorPart.cs
- ScriptResourceAttribute.cs
- StateManagedCollection.cs
- SourceInterpreter.cs
- DesignerFrame.cs
- AnyAllSearchOperator.cs
- PixelFormat.cs
- WindowsListViewItemCheckBox.cs
- Line.cs
- PenThread.cs
- Math.cs
- Section.cs
- DynamicEndpoint.cs
- BaseEntityWrapper.cs
- AspNetSynchronizationContext.cs
- SchemaNamespaceManager.cs
- clipboard.cs
- DataGridViewRowHeightInfoPushedEventArgs.cs
- PropertyMetadata.cs
- ToolStripDesignerUtils.cs
- DiagnosticTrace.cs
- TableDetailsCollection.cs
- AssemblyNameEqualityComparer.cs
- ContentElementAutomationPeer.cs
- EdmProperty.cs
- Math.cs
- SapiRecoInterop.cs
- DefaultHttpHandler.cs
- TypeUsage.cs
- HttpDebugHandler.cs
- XmlDomTextWriter.cs
- ColumnCollection.cs
- ItemsControl.cs
- HScrollBar.cs
- PropertyPathWorker.cs
- EdmItemError.cs
- InkCanvasInnerCanvas.cs
- odbcmetadatafactory.cs
- UserControl.cs
- CapiNative.cs