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
- ListViewDataItem.cs
- InternalDuplexBindingElement.cs
- StorageMappingItemCollection.cs
- CqlLexerHelpers.cs
- FontNamesConverter.cs
- VectorCollection.cs
- ReadOnlyHierarchicalDataSourceView.cs
- LinkLabelLinkClickedEvent.cs
- ConfigurationManagerHelperFactory.cs
- SqlExpander.cs
- DataTableCollection.cs
- SimplePropertyEntry.cs
- OuterGlowBitmapEffect.cs
- DbConnectionPoolGroupProviderInfo.cs
- AnnotationService.cs
- brushes.cs
- BitVector32.cs
- ScriptMethodAttribute.cs
- EncoderBestFitFallback.cs
- SystemColorTracker.cs
- TextTreeText.cs
- UrlAuthFailedErrorFormatter.cs
- MessageQueueTransaction.cs
- OperatorExpressions.cs
- LayoutUtils.cs
- CleanUpVirtualizedItemEventArgs.cs
- MetadataSerializer.cs
- ZeroOpNode.cs
- ScrollProviderWrapper.cs
- DocumentationServerProtocol.cs
- QuotaExceededException.cs
- ExpressionBindings.cs
- UpdatableGenericsFeature.cs
- GrammarBuilderDictation.cs
- TextParentUndoUnit.cs
- QueryExpression.cs
- BitmapFrameDecode.cs
- PropertyIDSet.cs
- CatalogZone.cs
- TextCollapsingProperties.cs
- XmlObjectSerializerReadContextComplexJson.cs
- XmlSerializationGeneratedCode.cs
- AesManaged.cs
- WSAddressing10ProblemHeaderQNameFault.cs
- VisualStates.cs
- TypeLoadException.cs
- GlobalProxySelection.cs
- FixedSOMTextRun.cs
- EdmError.cs
- String.cs
- WebControlAdapter.cs
- XmlNullResolver.cs
- StylusCollection.cs
- ILGenerator.cs
- EventsTab.cs
- ForeignKeyFactory.cs
- FontFaceLayoutInfo.cs
- CatalogZoneBase.cs
- WebRequest.cs
- RangeValuePattern.cs
- PaperSize.cs
- BroadcastEventHelper.cs
- InplaceBitmapMetadataWriter.cs
- OciLobLocator.cs
- CompilerScope.Storage.cs
- GridViewUpdateEventArgs.cs
- ControlBuilderAttribute.cs
- CustomServiceCredentials.cs
- XmlChoiceIdentifierAttribute.cs
- JsonUriDataContract.cs
- TreeNodeStyle.cs
- DoubleAnimation.cs
- StorageBasedPackageProperties.cs
- XsltException.cs
- NetMsmqSecurityMode.cs
- MachinePropertyVariants.cs
- SingleAnimation.cs
- OdbcConnectionHandle.cs
- hebrewshape.cs
- UnsafeNativeMethodsMilCoreApi.cs
- OleDbRowUpdatingEvent.cs
- XsltFunctions.cs
- MemberJoinTreeNode.cs
- NativeMethods.cs
- AccessDataSourceDesigner.cs
- SqlConnectionPoolGroupProviderInfo.cs
- Enlistment.cs
- TextChangedEventArgs.cs
- ByteAnimationBase.cs
- GraphicsContext.cs
- CounterCreationData.cs
- LineSegment.cs
- HttpConfigurationContext.cs
- HuffmanTree.cs
- UndoEngine.cs
- XmlSchemaSimpleTypeRestriction.cs
- StylusTip.cs
- SystemFonts.cs
- ConfigurationElementProperty.cs
- GridViewColumn.cs