Code:
/ DotNET / DotNET / 8.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
- EntitySqlException.cs
- LayoutTableCell.cs
- XPathConvert.cs
- LogLogRecordHeader.cs
- Debugger.cs
- ModelTreeEnumerator.cs
- ToolStripContainerActionList.cs
- SchemaTypeEmitter.cs
- CorruptStoreException.cs
- NavigationFailedEventArgs.cs
- APCustomTypeDescriptor.cs
- XmlRootAttribute.cs
- FrameDimension.cs
- TextServicesLoader.cs
- XmlLoader.cs
- CAGDesigner.cs
- BrowserDefinition.cs
- ProcessExitedException.cs
- X509SubjectKeyIdentifierClause.cs
- FamilyTypefaceCollection.cs
- DrawToolTipEventArgs.cs
- Point4D.cs
- CompilerWrapper.cs
- SetStateDesigner.cs
- RepeatBehaviorConverter.cs
- MarkupCompilePass1.cs
- DecimalAnimationBase.cs
- HighContrastHelper.cs
- ContentOperations.cs
- NavigationHelper.cs
- PreloadHost.cs
- DataExpression.cs
- DispatchChannelSink.cs
- DelayLoadType.cs
- ButtonChrome.cs
- Number.cs
- StorageEntityTypeMapping.cs
- BindStream.cs
- SqlStatistics.cs
- DataSourceGeneratorException.cs
- PrinterUnitConvert.cs
- DesignTimeDataBinding.cs
- StrongNameKeyPair.cs
- EdmFunction.cs
- Preprocessor.cs
- ByteRangeDownloader.cs
- ConstraintEnumerator.cs
- BaseValidator.cs
- DependencySource.cs
- EventNotify.cs
- PropertySourceInfo.cs
- ProfileModule.cs
- SmtpClient.cs
- CqlWriter.cs
- SqlDataSourceQueryEditor.cs
- CellTreeSimplifier.cs
- FilterException.cs
- DataGridHeaderBorder.cs
- ZoomingMessageFilter.cs
- XMLDiffLoader.cs
- TagMapInfo.cs
- SingleObjectCollection.cs
- ISAPIWorkerRequest.cs
- Rect.cs
- FlatButtonAppearance.cs
- PageWrapper.cs
- ExceptionValidationRule.cs
- ProcessManager.cs
- Transform3D.cs
- DependencyPropertyConverter.cs
- ScaleTransform3D.cs
- DispatcherOperation.cs
- ToolBarButtonDesigner.cs
- _NtlmClient.cs
- ThreadExceptionEvent.cs
- SymmetricAlgorithm.cs
- DesignerDataConnection.cs
- MatrixAnimationBase.cs
- DialogResultConverter.cs
- Msec.cs
- FileIOPermission.cs
- Latin1Encoding.cs
- OdbcPermission.cs
- BufferBuilder.cs
- DynamicRenderer.cs
- Visual3D.cs
- GeneralTransform3D.cs
- ShellProvider.cs
- RenderingEventArgs.cs
- DesignerTextWriter.cs
- DoubleAnimationUsingKeyFrames.cs
- NodeLabelEditEvent.cs
- EventEntry.cs
- GeometryDrawing.cs
- ZeroOpNode.cs
- WpfXamlMember.cs
- CheckBoxBaseAdapter.cs
- Currency.cs
- AxisAngleRotation3D.cs
- RawUIStateInputReport.cs