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
- ScriptResourceInfo.cs
- ScriptComponentDescriptor.cs
- CustomValidator.cs
- ValueHandle.cs
- ThreadAbortException.cs
- LineVisual.cs
- ClientUrlResolverWrapper.cs
- XmlDataSourceView.cs
- DebugHandleTracker.cs
- TypeUtil.cs
- ResXBuildProvider.cs
- SectionInput.cs
- DebugHandleTracker.cs
- DispatcherExceptionEventArgs.cs
- mactripleDES.cs
- PageThemeParser.cs
- StringSorter.cs
- EventProxy.cs
- CompressEmulationStream.cs
- EventRoute.cs
- DataGridItemAttachedStorage.cs
- SiteMap.cs
- MatcherBuilder.cs
- OpCellTreeNode.cs
- ScriptModule.cs
- Dictionary.cs
- IgnoreFlushAndCloseStream.cs
- ObjectNotFoundException.cs
- ADMembershipUser.cs
- ProcessHostMapPath.cs
- RecordBuilder.cs
- SQLBinaryStorage.cs
- BrowserDefinitionCollection.cs
- SafeRightsManagementQueryHandle.cs
- WorkflowInstanceContextProvider.cs
- SessionPageStateSection.cs
- TileBrush.cs
- KoreanLunisolarCalendar.cs
- DBDataPermission.cs
- Context.cs
- EventLogTraceListener.cs
- SerialPort.cs
- StrokeNodeData.cs
- CodeGenerator.cs
- PnrpPermission.cs
- CodeDirectoryCompiler.cs
- ProcessModelInfo.cs
- EncoderParameters.cs
- DataGridViewRowHeightInfoNeededEventArgs.cs
- WebPartConnectionsCloseVerb.cs
- SafeNativeMethodsCLR.cs
- SynchronizingStream.cs
- InternalConfigHost.cs
- ActivityTypeCodeDomSerializer.cs
- HttpWriter.cs
- CorruptingExceptionCommon.cs
- MetaData.cs
- ComplexPropertyEntry.cs
- UInt16Storage.cs
- SqlInternalConnectionSmi.cs
- webclient.cs
- AliasGenerator.cs
- ImportCatalogPart.cs
- _ConnectionGroup.cs
- DateTimeValueSerializerContext.cs
- ResXResourceSet.cs
- HistoryEventArgs.cs
- InvocationExpression.cs
- OracleDataReader.cs
- BindableTemplateBuilder.cs
- RuntimeConfigurationRecord.cs
- TranslateTransform3D.cs
- SiteMapHierarchicalDataSourceView.cs
- VectorConverter.cs
- InfoCardRSAPKCS1SignatureDeformatter.cs
- URLIdentityPermission.cs
- HScrollBar.cs
- CryptoApi.cs
- MemberPathMap.cs
- HttpClientCertificate.cs
- RepeatBehaviorConverter.cs
- MethodExpr.cs
- HtmlFormWrapper.cs
- MappingException.cs
- DataGridViewHeaderCell.cs
- ActivityExecutorDelegateInfo.cs
- XmlComment.cs
- Message.cs
- Roles.cs
- UserControlBuildProvider.cs
- JumpItem.cs
- GetPageNumberCompletedEventArgs.cs
- HostProtectionException.cs
- ViewPort3D.cs
- ToolStripControlHost.cs
- TextServicesHost.cs
- HttpListenerPrefixCollection.cs
- DataServiceResponse.cs
- InputScopeAttribute.cs
- State.cs