Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Xml / System / Xml / XPath / Internal / VariableQuery.cs / 1 / VariableQuery.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; using System.Xml.Xsl; internal sealed class VariableQuery : ExtensionQuery { private IXsltContextVariable variable; public VariableQuery(string name, string prefix) : base(prefix, name) {} private VariableQuery(VariableQuery other) : base(other) { this.variable = other.variable; } public override void SetXsltContext(XsltContext context) { if (context == null) { throw XPathException.Create(Res.Xp_NoContext); } if (this.xsltContext != context) { xsltContext = context; variable = xsltContext.ResolveVariable(prefix, name); // Since null is allowed for ResolveFunction, allow it for ResolveVariable as well if (variable == null) { throw XPathException.Create(Res.Xp_UndefVar, QName); } } } public override object Evaluate(XPathNodeIterator nodeIterator) { if (xsltContext == null) { throw XPathException.Create(Res.Xp_NoContext); } return ProcessResult(variable.Evaluate(xsltContext)); } public override XPathResultType StaticType { get { if (variable != null) { // Temp. fix to overcome dependency on static type return GetXPathType(Evaluate(null)); } XPathResultType result = variable != null ? variable.VariableType : XPathResultType.Any; if (result == XPathResultType.Error) { // In v.1 we confused Error & Any so now for backward compatibility we should allow users to return any of them. result = XPathResultType.Any; } return result; } } public override XPathNodeIterator Clone() { return new VariableQuery(this); } public override void PrintQuery(XmlWriter w) { w.WriteStartElement(this.GetType().Name); w.WriteAttributeString("name", prefix.Length != 0 ? prefix + ':' + name : name); w.WriteEndElement(); } } } // 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
- Attachment.cs
- KeyPullup.cs
- DetailsViewRowCollection.cs
- MenuItemStyle.cs
- _DigestClient.cs
- CalendarItem.cs
- InvalidOperationException.cs
- TextParagraphCache.cs
- InlineObject.cs
- BuildManager.cs
- WrapPanel.cs
- DbDataRecord.cs
- TimeSpanMinutesOrInfiniteConverter.cs
- FixedSOMPage.cs
- AggregateNode.cs
- DateTimeUtil.cs
- IChannel.cs
- RepeatButton.cs
- NameScopePropertyAttribute.cs
- CodeVariableReferenceExpression.cs
- JavaScriptSerializer.cs
- WindowsAuthenticationModule.cs
- FrameworkContentElement.cs
- XmlUTF8TextReader.cs
- CodeDelegateCreateExpression.cs
- TransformationRules.cs
- SourceSwitch.cs
- DropDownButton.cs
- HotSpot.cs
- SafeArrayRankMismatchException.cs
- DataBinding.cs
- ValidationHelpers.cs
- ExpressionBinding.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- ReceiveErrorHandling.cs
- XmlNavigatorFilter.cs
- ColorMatrix.cs
- MonitoringDescriptionAttribute.cs
- EntityDataSourceSelectedEventArgs.cs
- TargetParameterCountException.cs
- TypeExtension.cs
- ConnectionManagementElementCollection.cs
- InArgument.cs
- QueryAccessibilityHelpEvent.cs
- DataGridViewCellValidatingEventArgs.cs
- DataGridViewRowCancelEventArgs.cs
- MetadataItemCollectionFactory.cs
- StylusDownEventArgs.cs
- DocumentSequenceHighlightLayer.cs
- ConfigurationStrings.cs
- ResourcesGenerator.cs
- PositiveTimeSpanValidatorAttribute.cs
- TextElement.cs
- ProcessModelInfo.cs
- RoutedEventConverter.cs
- SourceFilter.cs
- BooleanToVisibilityConverter.cs
- ColumnWidthChangingEvent.cs
- IntellisenseTextBox.designer.cs
- ResumeStoryboard.cs
- RegexRunnerFactory.cs
- HierarchicalDataSourceIDConverter.cs
- SamlSubjectStatement.cs
- ApplicationSecurityInfo.cs
- PocoEntityKeyStrategy.cs
- ProfileBuildProvider.cs
- DocumentPageHost.cs
- RawTextInputReport.cs
- DisableDpiAwarenessAttribute.cs
- TabControlCancelEvent.cs
- SqlCharStream.cs
- WebControlsSection.cs
- EntityCodeGenerator.cs
- Listbox.cs
- SoapHelper.cs
- MenuItem.cs
- QilGenerator.cs
- unitconverter.cs
- CategoryValueConverter.cs
- SqlConnectionStringBuilder.cs
- IDReferencePropertyAttribute.cs
- EditorServiceContext.cs
- PingOptions.cs
- HyperLink.cs
- OdbcTransaction.cs
- TriggerBase.cs
- StreamResourceInfo.cs
- BodyGlyph.cs
- PrtCap_Public.cs
- AsyncOperationManager.cs
- GridViewHeaderRowPresenter.cs
- XmlWriter.cs
- AlignmentXValidation.cs
- AuthenticationConfig.cs
- TypeUnloadedException.cs
- CodeMemberProperty.cs
- PrinterUnitConvert.cs
- pingexception.cs
- ScrollProviderWrapper.cs
- SqlCacheDependencyDatabaseCollection.cs