Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Xml / System / Xml / XPath / Internal / IDQuery.cs / 1 / IDQuery.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace MS.Internal.Xml.XPath { using System; using System.Xml; using System.Xml.XPath; using System.Xml.Xsl; using System.Diagnostics; using System.Collections.Generic; internal sealed class IDQuery : CacheOutputQuery { public IDQuery(Query arg) : base(arg) {} private IDQuery(IDQuery other) : base(other) { } public override object Evaluate(XPathNodeIterator context) { object argVal = base.Evaluate(context); XPathNavigator contextNode = context.Current.Clone(); switch (GetXPathType(argVal)) { case XPathResultType.NodeSet: XPathNavigator temp; while ((temp = input.Advance()) != null) { ProcessIds(contextNode, temp.Value); } break; case XPathResultType.String: ProcessIds(contextNode, (string)argVal); break; case XPathResultType.Number: ProcessIds(contextNode, StringFunctions.toString((double)argVal)); break; case XPathResultType.Boolean: ProcessIds(contextNode, StringFunctions.toString((bool)argVal)); break; case XPathResultType_Navigator: ProcessIds(contextNode, ((XPathNavigator)argVal).Value); break; } return this; } void ProcessIds(XPathNavigator contextNode, string val) { string[] ids = XmlConvert.SplitString(val); for (int idx = 0; idx < ids.Length; idx++) { if (contextNode.MoveToId(ids[idx])) { Insert(outputBuffer, contextNode); } } } public override XPathNavigator MatchNode(XPathNavigator context) { Evaluate(new XPathSingletonIterator(context, /*moved:*/true)); XPathNavigator result; while ((result = Advance()) != null) { if (result.IsSamePosition(context)) { return context; } } return null; } public override XPathNodeIterator Clone() { return new IDQuery(this); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DoWorkEventArgs.cs
- MSAANativeProvider.cs
- ObfuscationAttribute.cs
- IItemContainerGenerator.cs
- WebPartConnectionsEventArgs.cs
- WebPartUtil.cs
- SplitterDesigner.cs
- DataGridCaption.cs
- APCustomTypeDescriptor.cs
- AssemblyAttributesGoHere.cs
- CollectionViewGroupRoot.cs
- Base64Stream.cs
- Brush.cs
- EndpointDispatcher.cs
- XhtmlBasicTextBoxAdapter.cs
- RequestResizeEvent.cs
- StylusPointPropertyUnit.cs
- XmlCharCheckingReader.cs
- InputBuffer.cs
- EventListenerClientSide.cs
- DrawItemEvent.cs
- TypeContext.cs
- PersonalizationState.cs
- ThrowOnMultipleAssignment.cs
- XamlDesignerSerializationManager.cs
- CancellationTokenRegistration.cs
- Soap12ProtocolReflector.cs
- odbcmetadatafactory.cs
- HostingEnvironmentWrapper.cs
- TabItemWrapperAutomationPeer.cs
- WindowsPrincipal.cs
- PeerApplicationLaunchInfo.cs
- XmlSchemaObjectTable.cs
- EntityAdapter.cs
- WorkflowRuntimeSection.cs
- OneWayChannelFactory.cs
- CardSpaceException.cs
- LocatorGroup.cs
- ChangePassword.cs
- DateTimePickerDesigner.cs
- CompilerState.cs
- XslTransform.cs
- SecurityContextKeyIdentifierClause.cs
- SuppressIldasmAttribute.cs
- MemberHolder.cs
- PocoEntityKeyStrategy.cs
- TransformDescriptor.cs
- ValueConversionAttribute.cs
- ReferencedType.cs
- BinaryNegotiation.cs
- DataServiceStreamResponse.cs
- SymbolPair.cs
- IIS7ConfigurationLoader.cs
- ResourcePermissionBase.cs
- ControlAdapter.cs
- CompilerGeneratedAttribute.cs
- WebHttpSecurityModeHelper.cs
- Boolean.cs
- BitmapCacheBrush.cs
- Activator.cs
- TextParagraphView.cs
- ButtonField.cs
- SqlConnection.cs
- FormatterConverter.cs
- Listbox.cs
- BaseParser.cs
- XmlSchemaElement.cs
- WithStatement.cs
- DeviceContexts.cs
- RewritingValidator.cs
- RowBinding.cs
- SqlCacheDependency.cs
- EdmToObjectNamespaceMap.cs
- EllipseGeometry.cs
- ImageMapEventArgs.cs
- StrokeCollection2.cs
- MouseGestureConverter.cs
- ObjRef.cs
- UserControlBuildProvider.cs
- MenuItemAutomationPeer.cs
- MainMenu.cs
- ImportCatalogPart.cs
- ExpressionBuilder.cs
- TextOutput.cs
- UnmanagedMemoryStreamWrapper.cs
- COM2EnumConverter.cs
- DirtyTextRange.cs
- Int64AnimationUsingKeyFrames.cs
- CryptoConfig.cs
- DropShadowBitmapEffect.cs
- BufferAllocator.cs
- RuntimeConfig.cs
- AppDomainInfo.cs
- Variant.cs
- StructuredProperty.cs
- AdministrationHelpers.cs
- MediaPlayerState.cs
- Point4DValueSerializer.cs
- SharedStatics.cs
- RegistrySecurity.cs