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
- DesignerTransactionCloseEvent.cs
- CoTaskMemSafeHandle.cs
- TextEditorMouse.cs
- BaseTemplateParser.cs
- NativeMethodsCLR.cs
- InheritanceAttribute.cs
- ConfigXmlWhitespace.cs
- DomainConstraint.cs
- XmlWellformedWriter.cs
- AuthStoreRoleProvider.cs
- TextTreeInsertElementUndoUnit.cs
- Site.cs
- DataColumnSelectionConverter.cs
- ConnectionInterfaceCollection.cs
- WorkflowItemPresenter.cs
- SessionStateContainer.cs
- SetterBase.cs
- ObjectParameterCollection.cs
- BrowserDefinition.cs
- XmlSchemaAnyAttribute.cs
- PersonalizationStateInfoCollection.cs
- PropertyToken.cs
- TextMetrics.cs
- MenuItemAutomationPeer.cs
- Registry.cs
- TypeKeyValue.cs
- PropertyRef.cs
- PointKeyFrameCollection.cs
- FilterEventArgs.cs
- CalendarDateChangedEventArgs.cs
- ListDataHelper.cs
- TheQuery.cs
- ScriptServiceAttribute.cs
- _AutoWebProxyScriptHelper.cs
- CodeDelegateCreateExpression.cs
- SecureStringHasher.cs
- DbCommandTree.cs
- CompilerResults.cs
- SessionChannels.cs
- Tokenizer.cs
- XD.cs
- BulletedList.cs
- SafeTokenHandle.cs
- PersistenceException.cs
- ContextStack.cs
- ValidationEventArgs.cs
- CodeBinaryOperatorExpression.cs
- StrokeCollection.cs
- srgsitem.cs
- CodeVariableReferenceExpression.cs
- SqlFlattener.cs
- CanonicalizationDriver.cs
- ElementsClipboardData.cs
- x509utils.cs
- PropertyMap.cs
- RecordBuilder.cs
- BamlLocalizationDictionary.cs
- GetImportedCardRequest.cs
- ConfigDefinitionUpdates.cs
- sqlser.cs
- BaseTransportHeaders.cs
- SourceFileInfo.cs
- DataException.cs
- InstalledFontCollection.cs
- LeafCellTreeNode.cs
- TreeNodeStyleCollectionEditor.cs
- StandardToolWindows.cs
- FormViewPageEventArgs.cs
- FrameworkElementFactory.cs
- PropertyStore.cs
- safelink.cs
- ACL.cs
- NTAccount.cs
- RuntimeHandles.cs
- NativeMethods.cs
- XmlUtf8RawTextWriter.cs
- DataSourceProvider.cs
- PhysicalAddress.cs
- DataGridViewBand.cs
- EnvelopedPkcs7.cs
- ApplicationSettingsBase.cs
- IfAction.cs
- FacetDescription.cs
- WindowsClaimSet.cs
- RawStylusInput.cs
- NativeMethods.cs
- MultipartIdentifier.cs
- DataGrid.cs
- HttpCapabilitiesSectionHandler.cs
- XmlElementAttributes.cs
- GeometryHitTestParameters.cs
- ByteStorage.cs
- OutputWindow.cs
- UntypedNullExpression.cs
- EmissiveMaterial.cs
- TextureBrush.cs
- GeneralTransform3DGroup.cs
- iisPickupDirectory.cs
- TableLayoutSettingsTypeConverter.cs
- Matrix.cs