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
- RuleRefElement.cs
- BmpBitmapDecoder.cs
- PersonalizationEntry.cs
- ObjectQuery_EntitySqlExtensions.cs
- PerformanceCounterPermissionEntry.cs
- Pens.cs
- parserscommon.cs
- nulltextnavigator.cs
- LayoutInformation.cs
- SimpleHandlerBuildProvider.cs
- WebUtil.cs
- FocusTracker.cs
- BCLDebug.cs
- ByteAnimationUsingKeyFrames.cs
- RegistrationServices.cs
- DescendantOverDescendantQuery.cs
- HyperLinkColumn.cs
- ADMembershipUser.cs
- XmlQueryType.cs
- DbParameterHelper.cs
- InvalidDataContractException.cs
- RemotingConfigParser.cs
- storepermission.cs
- DetailsViewRow.cs
- UserPreferenceChangedEventArgs.cs
- PointConverter.cs
- DataGridRowHeaderAutomationPeer.cs
- ValidateNames.cs
- StylusPlugin.cs
- ExtensionSimplifierMarkupObject.cs
- SelfIssuedSamlTokenFactory.cs
- Stream.cs
- NameHandler.cs
- CodeArrayCreateExpression.cs
- Context.cs
- Geometry3D.cs
- SqlNodeAnnotations.cs
- URLMembershipCondition.cs
- EntityDataSourceView.cs
- DateTimeConstantAttribute.cs
- ClrPerspective.cs
- BindingBase.cs
- AmbiguousMatchException.cs
- InstanceDataCollection.cs
- AngleUtil.cs
- HtmlTableCell.cs
- DynamicDataExtensions.cs
- StateRuntime.cs
- TextFormatter.cs
- EastAsianLunisolarCalendar.cs
- LocatorPart.cs
- ColorInterpolationModeValidation.cs
- ValueChangedEventManager.cs
- ToolStripSplitButton.cs
- CodeStatementCollection.cs
- Soap.cs
- _BufferOffsetSize.cs
- ReadOnlyHierarchicalDataSourceView.cs
- InitiatorSessionSymmetricTransportSecurityProtocol.cs
- GuidelineSet.cs
- SafeFindHandle.cs
- BreakSafeBase.cs
- DataGridItemCollection.cs
- HttpWebRequest.cs
- ToolStripProfessionalLowResolutionRenderer.cs
- CultureInfoConverter.cs
- ContextMenuStripActionList.cs
- XmlAttributeOverrides.cs
- InputScope.cs
- BamlTreeUpdater.cs
- Literal.cs
- OutputCacheProviderCollection.cs
- ObjectParameterCollection.cs
- _NetRes.cs
- IChannel.cs
- SqlCharStream.cs
- RoutingExtension.cs
- NGCPageContentSerializerAsync.cs
- DataObjectEventArgs.cs
- OwnerDrawPropertyBag.cs
- DbModificationClause.cs
- DictionaryEditChange.cs
- ThemeDictionaryExtension.cs
- GrabHandleGlyph.cs
- ListViewEditEventArgs.cs
- TemplateControlCodeDomTreeGenerator.cs
- ImageButton.cs
- XmlNodeList.cs
- util.cs
- Span.cs
- ByteBufferPool.cs
- ProjectionPlan.cs
- WebPartCatalogCloseVerb.cs
- BooleanFunctions.cs
- BrowserPolicyValidator.cs
- ConfigsHelper.cs
- UnaryNode.cs
- DodSequenceMerge.cs
- BamlLocalizableResourceKey.cs
- WebScriptEnablingBehavior.cs