Code:
/ Dotnetfx_Win7_3.5.1 / Dotnetfx_Win7_3.5.1 / 3.5.1 / DEVDIV / depot / DevDiv / releases / whidbey / NetFXspW7 / 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
- AccessText.cs
- TableAdapterManagerNameHandler.cs
- SqlBulkCopyColumnMappingCollection.cs
- ResXResourceReader.cs
- MbpInfo.cs
- Char.cs
- SoapReflectionImporter.cs
- DesignerActionList.cs
- HttpConfigurationSystem.cs
- UnaryOperationBinder.cs
- KeyMatchBuilder.cs
- ContentPlaceHolder.cs
- NetPeerTcpBindingCollectionElement.cs
- SQLStringStorage.cs
- RuleSettings.cs
- DesignerForm.cs
- GridViewRowEventArgs.cs
- DataTableReaderListener.cs
- SoapFault.cs
- Image.cs
- ServiceSettingsResponseInfo.cs
- DataGridViewAutoSizeColumnsModeEventArgs.cs
- ListSortDescription.cs
- AssemblyFilter.cs
- GridErrorDlg.cs
- InputBinding.cs
- DBParameter.cs
- SegmentInfo.cs
- Wizard.cs
- PlanCompilerUtil.cs
- ItemContainerGenerator.cs
- MinMaxParagraphWidth.cs
- DependencyObjectPropertyDescriptor.cs
- AttributeQuery.cs
- StateWorkerRequest.cs
- PageClientProxyGenerator.cs
- LogConverter.cs
- RenderCapability.cs
- HttpSessionStateBase.cs
- TextEditor.cs
- RequestBringIntoViewEventArgs.cs
- StrongNameUtility.cs
- NameValueSectionHandler.cs
- ApplicationGesture.cs
- ConfigDefinitionUpdates.cs
- DrawingDrawingContext.cs
- MarshalDirectiveException.cs
- ItemsChangedEventArgs.cs
- AttributeXamlType.cs
- TiffBitmapDecoder.cs
- ChannelTokenTypeConverter.cs
- AttachedPropertyMethodSelector.cs
- Variant.cs
- DesignTimeTemplateParser.cs
- EventItfInfo.cs
- InsufficientMemoryException.cs
- PersonalizationStateQuery.cs
- BitmapEffect.cs
- ObjectTokenCategory.cs
- OleDbFactory.cs
- AngleUtil.cs
- NegatedConstant.cs
- InplaceBitmapMetadataWriter.cs
- XmlSchemaAttributeGroupRef.cs
- XmlToDatasetMap.cs
- CombinedGeometry.cs
- SqlDelegatedTransaction.cs
- Int64Converter.cs
- DataGridViewAutoSizeColumnModeEventArgs.cs
- MetadataArtifactLoaderXmlReaderWrapper.cs
- BaseCodePageEncoding.cs
- CallbackHandler.cs
- SpecialNameAttribute.cs
- FileAuthorizationModule.cs
- XmlSchemaSequence.cs
- Matrix.cs
- WebBrowserNavigatingEventHandler.cs
- BlurBitmapEffect.cs
- PerformanceCountersElement.cs
- CacheMemory.cs
- DataGridCommandEventArgs.cs
- EnumValidator.cs
- SortFieldComparer.cs
- TargetException.cs
- RightNameExpirationInfoPair.cs
- OleDbDataReader.cs
- SelectionService.cs
- ListParagraph.cs
- ShaderRenderModeValidation.cs
- TraceSource.cs
- TextCollapsingProperties.cs
- MulticastNotSupportedException.cs
- ForwardPositionQuery.cs
- HttpChannelBindingToken.cs
- ScriptReferenceBase.cs
- NativeBuffer.cs
- SafeProcessHandle.cs
- EventWaitHandle.cs
- ProviderConnectionPoint.cs
- HttpListenerResponse.cs