Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / whidbey / netfxsp / ndp / fx / src / Xml / System / Xml / XPath / Internal / NamespaceQuery.cs / 1 / NamespaceQuery.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 NamespaceQuery : BaseAxisQuery { private bool onNamespace; public NamespaceQuery(Query qyParent, string Name, string Prefix, XPathNodeType Type) : base(qyParent, Name, Prefix, Type) {} private NamespaceQuery(NamespaceQuery other) : base(other) { this.onNamespace = other.onNamespace; } public override void Reset() { onNamespace = false; base.Reset(); } public override XPathNavigator Advance() { while (true) { if (!onNamespace) { currentNode = qyInput.Advance(); if (currentNode == null) { return null; } position = 0; currentNode = currentNode.Clone(); onNamespace = currentNode.MoveToFirstNamespace(); } else { onNamespace = currentNode.MoveToNextNamespace(); } if (onNamespace) { if (matches(currentNode)) { position++; return currentNode; } } } // while } // Advance public override bool matches(XPathNavigator e) { Debug.Assert(e.NodeType == XPathNodeType.Namespace); if (e.Value.Length == 0) { Debug.Assert(e.LocalName.Length == 0, "Only xmlns='' can have empty string as a value"); // Namespace axes never returns xmlns='', // because it's not a NS declaration but rather undeclaration. return false; } if (NameTest) { return Name.Equals(e.LocalName); } else { return true; } } public override XPathNodeIterator Clone() { return new NamespaceQuery(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 NamespaceQuery : BaseAxisQuery { private bool onNamespace; public NamespaceQuery(Query qyParent, string Name, string Prefix, XPathNodeType Type) : base(qyParent, Name, Prefix, Type) {} private NamespaceQuery(NamespaceQuery other) : base(other) { this.onNamespace = other.onNamespace; } public override void Reset() { onNamespace = false; base.Reset(); } public override XPathNavigator Advance() { while (true) { if (!onNamespace) { currentNode = qyInput.Advance(); if (currentNode == null) { return null; } position = 0; currentNode = currentNode.Clone(); onNamespace = currentNode.MoveToFirstNamespace(); } else { onNamespace = currentNode.MoveToNextNamespace(); } if (onNamespace) { if (matches(currentNode)) { position++; return currentNode; } } } // while } // Advance public override bool matches(XPathNavigator e) { Debug.Assert(e.NodeType == XPathNodeType.Namespace); if (e.Value.Length == 0) { Debug.Assert(e.LocalName.Length == 0, "Only xmlns='' can have empty string as a value"); // Namespace axes never returns xmlns='', // because it's not a NS declaration but rather undeclaration. return false; } if (NameTest) { return Name.Equals(e.LocalName); } else { return true; } } public override XPathNodeIterator Clone() { return new NamespaceQuery(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
- CheckoutException.cs
- Parameter.cs
- SpanIndex.cs
- WebPartsPersonalization.cs
- SymbolDocumentInfo.cs
- DbDataReader.cs
- ProfileSettings.cs
- DesignSurfaceManager.cs
- Int64Storage.cs
- MultipleViewPattern.cs
- XmlSchemaIdentityConstraint.cs
- ElementProxy.cs
- ThicknessAnimationUsingKeyFrames.cs
- IsolatedStorage.cs
- OutOfProcStateClientManager.cs
- ServiceModelSecurityTokenTypes.cs
- ToolStripItemClickedEventArgs.cs
- SecurityCriticalDataForSet.cs
- QueryTask.cs
- EditorOptionAttribute.cs
- PromptEventArgs.cs
- WFItemsToSpacerVisibility.cs
- XmlSchemaComplexContentExtension.cs
- VectorAnimationUsingKeyFrames.cs
- VerticalAlignConverter.cs
- GridViewDeleteEventArgs.cs
- FramingDecoders.cs
- EditorPartCollection.cs
- MultiAsyncResult.cs
- XmlNodeWriter.cs
- EdmProviderManifest.cs
- SapiRecoInterop.cs
- ExpressionStringBuilder.cs
- RepeaterCommandEventArgs.cs
- InvalidComObjectException.cs
- StdValidatorsAndConverters.cs
- ConfigUtil.cs
- SqlExpressionNullability.cs
- TypeBuilder.cs
- ObjectDisposedException.cs
- ToolStripInSituService.cs
- TextTreePropertyUndoUnit.cs
- StrongNamePublicKeyBlob.cs
- ListViewItemSelectionChangedEvent.cs
- PointCollectionConverter.cs
- SqlRemoveConstantOrderBy.cs
- SurrogateDataContract.cs
- DoubleCollectionValueSerializer.cs
- EventLogPermissionEntry.cs
- ToolTipAutomationPeer.cs
- XmlSchemaExporter.cs
- TextEncodedRawTextWriter.cs
- CredentialCache.cs
- TraceFilter.cs
- TextDecorationCollection.cs
- XmlSerializationReader.cs
- ILGenerator.cs
- CrossAppDomainChannel.cs
- CachedCompositeFamily.cs
- DBCommandBuilder.cs
- BinaryConverter.cs
- HttpDictionary.cs
- PathFigureCollection.cs
- SchemaAttDef.cs
- StickyNoteHelper.cs
- HttpConfigurationContext.cs
- WrappedIUnknown.cs
- SelectionHighlightInfo.cs
- FigureParaClient.cs
- DbConnectionOptions.cs
- CutCopyPasteHelper.cs
- UnsafeNativeMethods.cs
- QueryCursorEventArgs.cs
- CustomErrorsSection.cs
- ProcessManager.cs
- InvalidEnumArgumentException.cs
- DetailsViewDeletedEventArgs.cs
- NativeMethods.cs
- WebPartPersonalization.cs
- XsltSettings.cs
- TraceInternal.cs
- CalendarDataBindingHandler.cs
- DropShadowEffect.cs
- ItemType.cs
- XmlCharCheckingWriter.cs
- TextDataBindingHandler.cs
- TranslateTransform3D.cs
- X509CertificateChain.cs
- WindowsMenu.cs
- GeometryGroup.cs
- SizeAnimationClockResource.cs
- ThreadStateException.cs
- ProcessManager.cs
- Floater.cs
- indexingfiltermarshaler.cs
- ActivitiesCollection.cs
- FrameworkPropertyMetadata.cs
- Security.cs
- RandomNumberGenerator.cs
- AssociationEndMember.cs