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
- IncomingWebRequestContext.cs
- WindowsClaimSet.cs
- WebScriptServiceHostFactory.cs
- ChangeNode.cs
- FormatterConverter.cs
- PasswordPropertyTextAttribute.cs
- HttpCachePolicy.cs
- AbstractExpressions.cs
- ResourceProperty.cs
- WebPartVerbsEventArgs.cs
- XPathDescendantIterator.cs
- TemplateLookupAction.cs
- ActivationArguments.cs
- TimeIntervalCollection.cs
- ClientRuntimeConfig.cs
- HopperCache.cs
- ProxyWebPart.cs
- RootAction.cs
- PasswordTextContainer.cs
- PingOptions.cs
- PropertyDescriptorComparer.cs
- ThreadStaticAttribute.cs
- Point4DValueSerializer.cs
- HtmlString.cs
- formatstringdialog.cs
- RelationshipSet.cs
- XMLDiffLoader.cs
- BuildTopDownAttribute.cs
- SslStream.cs
- CodeCastExpression.cs
- _SslState.cs
- DictionaryEditChange.cs
- DependencyPropertyAttribute.cs
- CodeAttachEventStatement.cs
- ScriptingProfileServiceSection.cs
- NameObjectCollectionBase.cs
- CalendarItem.cs
- CommandBinding.cs
- ApplicationFileCodeDomTreeGenerator.cs
- Propagator.cs
- DataBoundControlHelper.cs
- UrlPath.cs
- TableCell.cs
- TraceLevelStore.cs
- InternalConfigHost.cs
- PropertyGridEditorPart.cs
- SchemaInfo.cs
- DesignerDataStoredProcedure.cs
- WrappedIUnknown.cs
- HtmlProps.cs
- BindingMemberInfo.cs
- DataKeyArray.cs
- FileDetails.cs
- PropertyMapper.cs
- DbCommandDefinition.cs
- DocumentXmlWriter.cs
- CapabilitiesSection.cs
- CaseInsensitiveComparer.cs
- StringUtil.cs
- SoapExtensionTypeElement.cs
- VisualTreeHelper.cs
- MDIControlStrip.cs
- AssemblyBuilder.cs
- SubMenuStyleCollection.cs
- categoryentry.cs
- ImageCodecInfoPrivate.cs
- StructuredType.cs
- AlignmentXValidation.cs
- PolicyLevel.cs
- DataGridItem.cs
- ServiceSecurityContext.cs
- TreeChangeInfo.cs
- BulletedListDesigner.cs
- ProcessHostServerConfig.cs
- StringCollection.cs
- SrgsRuleRef.cs
- XmlQueryType.cs
- KeySplineConverter.cs
- IgnoreFileBuildProvider.cs
- ProtectedProviderSettings.cs
- InputProcessorProfilesLoader.cs
- Propagator.Evaluator.cs
- SafeArrayRankMismatchException.cs
- SqlTypeConverter.cs
- InternalSafeNativeMethods.cs
- RecognizedWordUnit.cs
- ConstraintEnumerator.cs
- DragDrop.cs
- WpfSharedBamlSchemaContext.cs
- ListSortDescriptionCollection.cs
- ContentType.cs
- XPathItem.cs
- CodeDelegateInvokeExpression.cs
- OdbcTransaction.cs
- BindingSource.cs
- UriWriter.cs
- HostingEnvironmentSection.cs
- SqlGatherConsumedAliases.cs
- AdornedElementPlaceholder.cs
- UIAgentRequest.cs