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
- GregorianCalendar.cs
- XslUrlEditor.cs
- TagPrefixAttribute.cs
- ScrollItemProviderWrapper.cs
- SerializationHelper.cs
- Vector3DAnimationBase.cs
- ReferencedAssembly.cs
- UdpDiscoveryEndpointElement.cs
- LogExtentCollection.cs
- AssemblyResourceLoader.cs
- RectValueSerializer.cs
- TypeListConverter.cs
- dtdvalidator.cs
- PropertyStore.cs
- CapabilitiesUse.cs
- LinqDataView.cs
- InstanceBehavior.cs
- OrderPreservingMergeHelper.cs
- FullTextBreakpoint.cs
- XmlValidatingReader.cs
- RoutedUICommand.cs
- MergePropertyDescriptor.cs
- _FixedSizeReader.cs
- AutomationElementIdentifiers.cs
- EntityDataSourceViewSchema.cs
- CompilerCollection.cs
- EmptyQuery.cs
- IIS7UserPrincipal.cs
- __ConsoleStream.cs
- CodeIndexerExpression.cs
- DbParameterCollectionHelper.cs
- PermissionSetTriple.cs
- InternalConfigSettingsFactory.cs
- KoreanCalendar.cs
- ProfileGroupSettings.cs
- AdapterUtil.cs
- DocumentCollection.cs
- SamlAudienceRestrictionCondition.cs
- FixedTextView.cs
- WmlCommandAdapter.cs
- SiblingIterators.cs
- CodeDomSerializerBase.cs
- RowBinding.cs
- IImplicitResourceProvider.cs
- PassportPrincipal.cs
- SafeProcessHandle.cs
- SynchronizationContext.cs
- IdentityModelStringsVersion1.cs
- KnowledgeBase.cs
- ModelFunctionTypeElement.cs
- ValueQuery.cs
- CompletionProxy.cs
- XmlElementAttributes.cs
- DataAdapter.cs
- PointLightBase.cs
- SqlCharStream.cs
- SafeFileMapViewHandle.cs
- RSAOAEPKeyExchangeFormatter.cs
- SimpleType.cs
- ConfigXmlElement.cs
- SoapIncludeAttribute.cs
- ControlType.cs
- ToolStripItemImageRenderEventArgs.cs
- GridToolTip.cs
- AsymmetricSignatureFormatter.cs
- BatchStream.cs
- UnauthorizedWebPart.cs
- PackageStore.cs
- PagePropertiesChangingEventArgs.cs
- StrokeCollection2.cs
- shaperfactoryquerycachekey.cs
- ListViewItemSelectionChangedEvent.cs
- RefreshPropertiesAttribute.cs
- PointLight.cs
- RootProfilePropertySettingsCollection.cs
- MimeFormReflector.cs
- WebBrowser.cs
- XmlIncludeAttribute.cs
- DocumentGrid.cs
- ApplicationBuildProvider.cs
- BaseServiceProvider.cs
- MetadataItemCollectionFactory.cs
- XomlSerializationHelpers.cs
- RegexMatch.cs
- ConfigXmlComment.cs
- FileUtil.cs
- CertificateManager.cs
- ParseHttpDate.cs
- regiisutil.cs
- ConditionalWeakTable.cs
- HttpResponseInternalWrapper.cs
- FixedSOMElement.cs
- ObjectSet.cs
- ApplicationTrust.cs
- NavigateEvent.cs
- TemplatedMailWebEventProvider.cs
- WindowsFormsSectionHandler.cs
- ToolStripArrowRenderEventArgs.cs
- ItemContainerGenerator.cs
- MethodBuilder.cs