Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / 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. // //[....] //----------------------------------------------------------------------------- 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ScriptResourceHandler.cs
- NetworkAddressChange.cs
- ScrollProperties.cs
- Rect3D.cs
- Formatter.cs
- PrimitiveRenderer.cs
- DataGridViewControlCollection.cs
- GridViewUpdatedEventArgs.cs
- TableItemPattern.cs
- Configuration.cs
- CreateUserWizardAutoFormat.cs
- Verify.cs
- DesignerSerializationVisibilityAttribute.cs
- XmlSchemaAnnotated.cs
- SettingsPropertyIsReadOnlyException.cs
- LocalizationParserHooks.cs
- PropertyGridEditorPart.cs
- ParallelTimeline.cs
- ComponentEditorPage.cs
- StringInfo.cs
- RubberbandSelector.cs
- ModelVisual3D.cs
- PropertyPathWorker.cs
- DataObjectEventArgs.cs
- RangeValueProviderWrapper.cs
- Mappings.cs
- SourceItem.cs
- SimpleBitVector32.cs
- ClipboardProcessor.cs
- PageMediaType.cs
- Parsers.cs
- DocumentGridPage.cs
- MasterPageParser.cs
- CircleHotSpot.cs
- DebugView.cs
- activationcontext.cs
- ClientBuildManager.cs
- BackStopAuthenticationModule.cs
- DbConnectionPoolGroupProviderInfo.cs
- WriteableBitmap.cs
- Point3DAnimationBase.cs
- XamlInt32CollectionSerializer.cs
- LaxModeSecurityHeaderElementInferenceEngine.cs
- CodeCatchClause.cs
- BitStack.cs
- ChineseLunisolarCalendar.cs
- XomlCompilerResults.cs
- TablePattern.cs
- XPathSingletonIterator.cs
- SoapObjectInfo.cs
- QuerySettings.cs
- MeshGeometry3D.cs
- HtmlInputText.cs
- DataDesignUtil.cs
- GeometryModel3D.cs
- DesignerDataView.cs
- DesignerValidatorAdapter.cs
- OdbcParameter.cs
- MimeMultiPart.cs
- RenderCapability.cs
- TcpTransportBindingElement.cs
- LinkedResource.cs
- Bold.cs
- ObjectCloneHelper.cs
- TrackingProfileCache.cs
- ArgumentOutOfRangeException.cs
- TraceLevelStore.cs
- BaseConfigurationRecord.cs
- BasePropertyDescriptor.cs
- HttpSocketManager.cs
- CommandBinding.cs
- Oci.cs
- SaveFileDialog.cs
- CompilerInfo.cs
- ConstrainedDataObject.cs
- odbcmetadatacolumnnames.cs
- AuthenticateEventArgs.cs
- ExpressionsCollectionConverter.cs
- Adorner.cs
- SqlConnectionStringBuilder.cs
- Wildcard.cs
- SelectionHighlightInfo.cs
- MgmtConfigurationRecord.cs
- CurrentChangingEventArgs.cs
- CreateUserWizardDesigner.cs
- CatalogPart.cs
- ControlCachePolicy.cs
- EditorAttributeInfo.cs
- EnumerableRowCollectionExtensions.cs
- WhitespaceRule.cs
- Margins.cs
- NotifyIcon.cs
- HttpInputStream.cs
- SpecialNameAttribute.cs
- XmlDigitalSignatureProcessor.cs
- IdentityNotMappedException.cs
- InfoCardRSACryptoProvider.cs
- PerformanceCounterManager.cs
- CollectionChangedEventManager.cs
- JsonReaderWriterFactory.cs