Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XPath / Internal / IDQuery.cs / 1305376 / 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
- TextRange.cs
- PromptStyle.cs
- CursorConverter.cs
- DynamicPropertyHolder.cs
- NamespaceCollection.cs
- HwndStylusInputProvider.cs
- CryptographicAttribute.cs
- Addressing.cs
- ServicesUtilities.cs
- CustomUserNameSecurityTokenAuthenticator.cs
- TemplatePagerField.cs
- WeakReferenceEnumerator.cs
- NetworkInterface.cs
- SynchronousChannel.cs
- CalendarBlackoutDatesCollection.cs
- EventDescriptor.cs
- DataListItem.cs
- ClickablePoint.cs
- PenLineCapValidation.cs
- TreeViewBindingsEditor.cs
- UIntPtr.cs
- AutomationElementCollection.cs
- EntityModelBuildProvider.cs
- SqlDataSourceCache.cs
- PromptEventArgs.cs
- BitmapEffect.cs
- CryptoConfig.cs
- MatrixTransform.cs
- Publisher.cs
- XmlEntity.cs
- HttpValueCollection.cs
- WeakHashtable.cs
- TableLayoutColumnStyleCollection.cs
- EntityConnectionStringBuilder.cs
- Win32.cs
- DataFormats.cs
- DynamicMethod.cs
- NamespaceInfo.cs
- SizeAnimationUsingKeyFrames.cs
- NodeInfo.cs
- ToolboxItemFilterAttribute.cs
- HtmlTableRowCollection.cs
- Dispatcher.cs
- BufferedGraphics.cs
- CategoryGridEntry.cs
- ReferentialConstraint.cs
- CryptoApi.cs
- Relationship.cs
- TimeZone.cs
- PickDesigner.xaml.cs
- KeyGesture.cs
- NetSectionGroup.cs
- XPathNodeInfoAtom.cs
- TextEditorSelection.cs
- SingleSelectRootGridEntry.cs
- AccessDataSource.cs
- SessionStateItemCollection.cs
- DataMemberAttribute.cs
- ChangesetResponse.cs
- TextOnlyOutput.cs
- ApplicationContext.cs
- Selection.cs
- FormsAuthenticationModule.cs
- InheritanceContextChangedEventManager.cs
- JsonReaderDelegator.cs
- DataGridDefaultColumnWidthTypeConverter.cs
- TypeListConverter.cs
- NameValueCollection.cs
- IfAction.cs
- _LocalDataStoreMgr.cs
- SessionParameter.cs
- SelfIssuedAuthRSACryptoProvider.cs
- InputLangChangeEvent.cs
- IPAddress.cs
- Pair.cs
- TraceRecords.cs
- ActivityTypeResolver.xaml.cs
- Menu.cs
- NonVisualControlAttribute.cs
- TableChangeProcessor.cs
- Int16KeyFrameCollection.cs
- DataGridViewComboBoxCell.cs
- FunctionDefinition.cs
- MeshGeometry3D.cs
- ConfigurationLockCollection.cs
- ObjectHandle.cs
- EntityType.cs
- BitmapEffectInputConnector.cs
- DesignerRegionMouseEventArgs.cs
- DataGridColumn.cs
- KeyNotFoundException.cs
- RequestChannel.cs
- LogFlushAsyncResult.cs
- ScriptBehaviorDescriptor.cs
- AppendHelper.cs
- TemplatedAdorner.cs
- ObjectPersistData.cs
- KerberosTicketHashIdentifierClause.cs
- DrawingAttributesDefaultValueFactory.cs
- TableCellCollection.cs