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
- ValueTypeFixupInfo.cs
- MdiWindowListStrip.cs
- SafeEventLogWriteHandle.cs
- OutKeywords.cs
- CfgParser.cs
- WindowsSecurityTokenAuthenticator.cs
- DataTableNewRowEvent.cs
- UnmanagedMarshal.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- GenerateScriptTypeAttribute.cs
- WebHeaderCollection.cs
- GridViewColumn.cs
- BinarySerializer.cs
- TcpClientCredentialType.cs
- CodeTypeMemberCollection.cs
- ConfigXmlComment.cs
- BitmapScalingModeValidation.cs
- SoapAttributeAttribute.cs
- TextEditorDragDrop.cs
- MethodBuilder.cs
- DataGridViewRowHeaderCell.cs
- Pair.cs
- MarkupWriter.cs
- PropertyGridEditorPart.cs
- ErrorFormatter.cs
- DependencyObjectProvider.cs
- EnumerableRowCollectionExtensions.cs
- ListenDesigner.cs
- FormatControl.cs
- TreeViewBindingsEditor.cs
- LoginName.cs
- StoragePropertyMapping.cs
- _SpnDictionary.cs
- UInt16.cs
- SingleStorage.cs
- RSAOAEPKeyExchangeFormatter.cs
- XmlNamespaceDeclarationsAttribute.cs
- RelationshipEndCollection.cs
- RealizationContext.cs
- CustomErrorsSection.cs
- CodeTypeReferenceExpression.cs
- ImageSource.cs
- ObjectHelper.cs
- ListViewDataItem.cs
- SingleResultAttribute.cs
- VoiceInfo.cs
- UIInitializationException.cs
- ToolStripItemImageRenderEventArgs.cs
- FreezableCollection.cs
- EUCJPEncoding.cs
- SettingsSavedEventArgs.cs
- InputDevice.cs
- DtrList.cs
- DictionaryChange.cs
- RegistryPermission.cs
- DropTarget.cs
- XmlSchemaImporter.cs
- ThrowHelper.cs
- DataGridPagerStyle.cs
- MimePart.cs
- UnmanagedMarshal.cs
- PathFigureCollectionValueSerializer.cs
- TargetException.cs
- AnnotationMap.cs
- ResourceDisplayNameAttribute.cs
- SqlTriggerContext.cs
- FixedNode.cs
- TimeSpan.cs
- PersonalizationEntry.cs
- TextEditor.cs
- StylusButtonCollection.cs
- DbParameterCollectionHelper.cs
- Int16AnimationUsingKeyFrames.cs
- WebUtil.cs
- EncodingDataItem.cs
- Utils.cs
- TextControl.cs
- SafeFileHandle.cs
- BmpBitmapDecoder.cs
- SoapFault.cs
- cookiecontainer.cs
- DrawListViewSubItemEventArgs.cs
- HttpHandlerActionCollection.cs
- MissingManifestResourceException.cs
- SqlBulkCopy.cs
- TemplatePagerField.cs
- RoleServiceManager.cs
- BoundConstants.cs
- EntityException.cs
- ClientConvert.cs
- StandardMenuStripVerb.cs
- KeyTime.cs
- InfoCardKeyedHashAlgorithm.cs
- CodeMemberEvent.cs
- MetadataCacheItem.cs
- _HelperAsyncResults.cs
- mactripleDES.cs
- TextOnlyOutput.cs
- FieldNameLookup.cs
- DataGridViewSelectedCellCollection.cs