Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- HtmlGenericControl.cs
- PreApplicationStartMethodAttribute.cs
- UdpUtility.cs
- SqlExpander.cs
- ApplicationDirectoryMembershipCondition.cs
- ResXResourceReader.cs
- MobileErrorInfo.cs
- Bits.cs
- DataGridViewSortCompareEventArgs.cs
- DoubleLink.cs
- AccessedThroughPropertyAttribute.cs
- ExceptionCollection.cs
- MemoryResponseElement.cs
- SystemInfo.cs
- EdmValidator.cs
- LineServices.cs
- NonBatchDirectoryCompiler.cs
- SeverityFilter.cs
- BoundColumn.cs
- ExecutionContext.cs
- MenuBase.cs
- WebRequestModuleElementCollection.cs
- UidManager.cs
- ExtensionQuery.cs
- OpenTypeMethods.cs
- TypeForwardedToAttribute.cs
- NgenServicingAttributes.cs
- LeftCellWrapper.cs
- PolicyStatement.cs
- MimeAnyImporter.cs
- dtdvalidator.cs
- LocalClientSecuritySettingsElement.cs
- DataGridColumnCollectionEditor.cs
- ContainsRowNumberChecker.cs
- connectionpool.cs
- NavigationCommands.cs
- httpapplicationstate.cs
- safex509handles.cs
- RawStylusInput.cs
- TableParaClient.cs
- XPathAncestorIterator.cs
- WindowsBrush.cs
- FrameDimension.cs
- DesignerTextViewAdapter.cs
- DataBoundControlAdapter.cs
- ImpersonationContext.cs
- IArgumentProvider.cs
- RegisteredHiddenField.cs
- TokenCreationException.cs
- InputScopeAttribute.cs
- TextTreePropertyUndoUnit.cs
- WindowPatternIdentifiers.cs
- RolePrincipal.cs
- BindingManagerDataErrorEventArgs.cs
- ipaddressinformationcollection.cs
- ObjectTag.cs
- HtmlTableCell.cs
- Vector3DCollection.cs
- HyperLink.cs
- PackagingUtilities.cs
- GeometryGroup.cs
- TextPointerBase.cs
- FigureParaClient.cs
- XmlCharType.cs
- CookieParameter.cs
- HttpValueCollection.cs
- HierarchicalDataBoundControlAdapter.cs
- TraceFilter.cs
- CompositeDataBoundControl.cs
- WebPartConnectionsCancelVerb.cs
- XslTransform.cs
- ChannelSinkStacks.cs
- XmlChildEnumerator.cs
- CodeDomConfigurationHandler.cs
- TrackBar.cs
- SafeFileMapViewHandle.cs
- PersistStreamTypeWrapper.cs
- Geometry.cs
- InfiniteTimeSpanConverter.cs
- ImageListImage.cs
- DataGridViewRowsRemovedEventArgs.cs
- ListBoxAutomationPeer.cs
- OdbcInfoMessageEvent.cs
- ConstructorBuilder.cs
- SimpleMailWebEventProvider.cs
- CodeComment.cs
- ThreadPool.cs
- ToolboxItem.cs
- ModelPerspective.cs
- BamlRecords.cs
- AccessibleObject.cs
- LogStream.cs
- UserNamePasswordClientCredential.cs
- FileDialogCustomPlace.cs
- KeyValueInternalCollection.cs
- SessionStateContainer.cs
- ParseHttpDate.cs
- CounterCreationDataCollection.cs
- DirtyTextRange.cs
- DesignerHost.cs