Code:
/ DotNET / DotNET / 8.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
- SqlDataReaderSmi.cs
- EdgeProfileValidation.cs
- ResourcePermissionBaseEntry.cs
- Utils.cs
- PropertyItem.cs
- QilTargetType.cs
- lengthconverter.cs
- backend.cs
- RequiredFieldValidator.cs
- DataSourceSelectArguments.cs
- GenericTypeParameterConverter.cs
- XmlSchemaImport.cs
- HebrewCalendar.cs
- GeneralEndpointIdentity.cs
- TableRow.cs
- ClockController.cs
- ScalarConstant.cs
- NodeInfo.cs
- DataPager.cs
- DrawingServices.cs
- KnownTypes.cs
- TableRow.cs
- FindResponse.cs
- CancellationTokenSource.cs
- HashMembershipCondition.cs
- COM2TypeInfoProcessor.cs
- NegotiationTokenProvider.cs
- QilTypeChecker.cs
- DataGridViewBand.cs
- DataGridViewImageCell.cs
- ModelTreeEnumerator.cs
- IQueryable.cs
- MetaModel.cs
- XmlHierarchicalDataSourceView.cs
- HwndStylusInputProvider.cs
- RefreshPropertiesAttribute.cs
- SHA512Managed.cs
- SafeRegistryHandle.cs
- ListViewContainer.cs
- ComponentSerializationService.cs
- DataListCommandEventArgs.cs
- SqlXml.cs
- Util.cs
- odbcmetadatacolumnnames.cs
- TabItemWrapperAutomationPeer.cs
- Pair.cs
- TrimSurroundingWhitespaceAttribute.cs
- CompiledRegexRunner.cs
- StringDictionaryWithComparer.cs
- Object.cs
- WindowsListViewItemCheckBox.cs
- Fonts.cs
- DataRow.cs
- SqlBuffer.cs
- CommandValueSerializer.cs
- DesignerMetadata.cs
- FtpWebResponse.cs
- DataBinder.cs
- ByteStack.cs
- Style.cs
- PagerStyle.cs
- TypeReference.cs
- SplineQuaternionKeyFrame.cs
- SQLInt32.cs
- connectionpool.cs
- SQLInt64Storage.cs
- DBCSCodePageEncoding.cs
- WebConfigurationHostFileChange.cs
- MediaElement.cs
- RoleBoolean.cs
- IntegerValidator.cs
- SamlAction.cs
- DataBinder.cs
- GeneratedView.cs
- ToolStripMenuItem.cs
- PolyQuadraticBezierSegment.cs
- DataDocumentXPathNavigator.cs
- coordinatorscratchpad.cs
- ScopelessEnumAttribute.cs
- ICspAsymmetricAlgorithm.cs
- DrawingVisual.cs
- ToolBarButtonClickEvent.cs
- BitmapCacheBrush.cs
- WebPartEventArgs.cs
- OracleInfoMessageEventArgs.cs
- SectionVisual.cs
- VirtualDirectoryMappingCollection.cs
- RequestCacheManager.cs
- TypeInitializationException.cs
- XPathDocument.cs
- RemoteWebConfigurationHostServer.cs
- safex509handles.cs
- BulletChrome.cs
- RegularExpressionValidator.cs
- LocalBuilder.cs
- OutputCacheSection.cs
- Registry.cs
- QilPatternFactory.cs
- EditorZoneDesigner.cs
- Fault.cs