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
- WebPartDescriptionCollection.cs
- ScriptResourceAttribute.cs
- AspProxy.cs
- ComponentEditorForm.cs
- Bits.cs
- TextElementCollectionHelper.cs
- SelectionItemProviderWrapper.cs
- RotateTransform3D.cs
- MetadataArtifactLoaderCompositeResource.cs
- FamilyTypeface.cs
- HttpDebugHandler.cs
- SqlDependencyListener.cs
- XmlSchemaCompilationSettings.cs
- RowsCopiedEventArgs.cs
- DiffuseMaterial.cs
- DefaultValueAttribute.cs
- ConcurrentBag.cs
- InputScope.cs
- CodeIdentifier.cs
- BaseHashHelper.cs
- WebMessageEncodingElement.cs
- SelectionPattern.cs
- DefaultMemberAttribute.cs
- SubMenuStyleCollection.cs
- SharedUtils.cs
- ContentElement.cs
- CodeIterationStatement.cs
- DataExchangeServiceBinder.cs
- BaseCollection.cs
- SmtpMail.cs
- TraceHandler.cs
- WsdlInspector.cs
- PersonalizationProvider.cs
- FaultException.cs
- CompilerScopeManager.cs
- ProcessThread.cs
- GZipDecoder.cs
- IdentityHolder.cs
- ValidationEventArgs.cs
- SqlDataReaderSmi.cs
- ComponentConverter.cs
- ProxyRpc.cs
- Rect3D.cs
- TargetInvocationException.cs
- SubpageParagraph.cs
- TextFormatterImp.cs
- DataServices.cs
- CrossAppDomainChannel.cs
- WriterOutput.cs
- HttpCacheVary.cs
- PersonalizableAttribute.cs
- MediaElementAutomationPeer.cs
- PasswordPropertyTextAttribute.cs
- RegexTree.cs
- XmlSchemaNotation.cs
- ReflectEventDescriptor.cs
- DbProviderSpecificTypePropertyAttribute.cs
- SymbolTable.cs
- PersonalizableAttribute.cs
- BCLDebug.cs
- DataGridTableCollection.cs
- HandleCollector.cs
- ScriptControlDescriptor.cs
- IssuanceLicense.cs
- PipelineModuleStepContainer.cs
- DropShadowBitmapEffect.cs
- DropShadowEffect.cs
- InfiniteIntConverter.cs
- WebBrowserContainer.cs
- Gdiplus.cs
- SingleObjectCollection.cs
- DetailsViewUpdateEventArgs.cs
- TextElementCollectionHelper.cs
- complextypematerializer.cs
- CqlErrorHelper.cs
- XmlSignificantWhitespace.cs
- StyleSheetDesigner.cs
- AspCompat.cs
- ErrorRuntimeConfig.cs
- TextServicesLoader.cs
- TextShapeableCharacters.cs
- PageThemeBuildProvider.cs
- TextEditorMouse.cs
- UTF8Encoding.cs
- GradientSpreadMethodValidation.cs
- TabControl.cs
- AssemblyBuilder.cs
- WebPartsSection.cs
- SqlDependencyListener.cs
- ToolStripRendererSwitcher.cs
- BinaryVersion.cs
- EmptyCollection.cs
- EdmItemError.cs
- DnsPermission.cs
- RequestCachingSection.cs
- GenericRootAutomationPeer.cs
- XmlSchemaComplexContent.cs
- HostProtectionException.cs
- TypeConverterMarkupExtension.cs
- VBCodeProvider.cs