Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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
- NamespaceEmitter.cs
- WebConfigurationManager.cs
- BindingContext.cs
- CookielessHelper.cs
- TemplateInstanceAttribute.cs
- MachinePropertyVariants.cs
- DbParameterCollection.cs
- Win32Native.cs
- DeclarativeCatalogPart.cs
- SqlDataSourceView.cs
- ObjectContext.cs
- MenuEventArgs.cs
- XmlRootAttribute.cs
- CatalogPartCollection.cs
- EmissiveMaterial.cs
- SqlDataSourceConfigureSelectPanel.cs
- RuntimeHelpers.cs
- HtmlInputText.cs
- ResourceKey.cs
- DataGridViewButtonColumn.cs
- SystemColorTracker.cs
- RoleExceptions.cs
- OlePropertyStructs.cs
- cache.cs
- XamlToRtfWriter.cs
- Point3DCollection.cs
- XPathNodePointer.cs
- AutoGeneratedFieldProperties.cs
- PersonalizationStateInfo.cs
- OledbConnectionStringbuilder.cs
- _AuthenticationState.cs
- SliderAutomationPeer.cs
- TableHeaderCell.cs
- RoleGroup.cs
- DataProtectionSecurityStateEncoder.cs
- IntSumAggregationOperator.cs
- WebFormsRootDesigner.cs
- EventLogPermissionEntryCollection.cs
- Iis7Helper.cs
- LiteralControl.cs
- IsolationInterop.cs
- TextWriter.cs
- SoapExtensionImporter.cs
- IconBitmapDecoder.cs
- GraphicsContext.cs
- TcpConnectionPoolSettingsElement.cs
- WinInetCache.cs
- PaintValueEventArgs.cs
- _UriSyntax.cs
- CompilationLock.cs
- UpdateTracker.cs
- MenuCommandService.cs
- IResourceProvider.cs
- DBCommandBuilder.cs
- nulltextcontainer.cs
- ConcurrentStack.cs
- CompilationUtil.cs
- ListCommandEventArgs.cs
- MenuEventArgs.cs
- DataTableReaderListener.cs
- InputScopeNameConverter.cs
- ListBox.cs
- XmlWriter.cs
- SocketAddress.cs
- SerializationTrace.cs
- AttributeCollection.cs
- WebPartTransformerCollection.cs
- SingleTagSectionHandler.cs
- NotImplementedException.cs
- EncoderParameter.cs
- FileUtil.cs
- DynamicILGenerator.cs
- Variable.cs
- ActivationServices.cs
- WebPartVerbCollection.cs
- EastAsianLunisolarCalendar.cs
- SendMailErrorEventArgs.cs
- ObjectToken.cs
- SqlResolver.cs
- FamilyTypefaceCollection.cs
- InitializationEventAttribute.cs
- PeerCustomResolverBindingElement.cs
- DataGridRowEventArgs.cs
- XmlFormatExtensionPointAttribute.cs
- Page.cs
- PageStatePersister.cs
- HTMLTagNameToTypeMapper.cs
- XmlElementCollection.cs
- DesignBindingValueUIHandler.cs
- Internal.cs
- DesignerVerbCollection.cs
- TextElementEditingBehaviorAttribute.cs
- NodeCounter.cs
- Assert.cs
- DbModificationClause.cs
- StoreAnnotationsMap.cs
- ComponentEditorForm.cs
- UndirectedGraph.cs
- XmlBinaryReader.cs
- DataGridViewSelectedCellsAccessibleObject.cs