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
- Matrix3D.cs
- SqlConnectionFactory.cs
- DynamicDocumentPaginator.cs
- CacheModeValueSerializer.cs
- Mapping.cs
- DispatcherProcessingDisabled.cs
- DeclarativeCatalogPart.cs
- EntityDataSourceEntityTypeFilterItem.cs
- CryptoStream.cs
- EdmSchemaAttribute.cs
- InstanceDescriptor.cs
- OutOfMemoryException.cs
- ToolStripOverflow.cs
- TextWriterTraceListener.cs
- SqlClientWrapperSmiStream.cs
- HebrewNumber.cs
- X509ChainElement.cs
- MouseDevice.cs
- GraphicsContext.cs
- FileLogRecord.cs
- DrawListViewSubItemEventArgs.cs
- SupportsPreviewControlAttribute.cs
- XmlSerializerFactory.cs
- XPathNavigatorKeyComparer.cs
- EntityDataSourceColumn.cs
- XmlCustomFormatter.cs
- AxisAngleRotation3D.cs
- SymbolMethod.cs
- CustomErrorsSectionWrapper.cs
- PerfService.cs
- XNodeValidator.cs
- NavigationWindow.cs
- NTAccount.cs
- ProfileGroupSettings.cs
- SelectionService.cs
- PersonalizationStateInfo.cs
- ControlTemplate.cs
- JsonSerializer.cs
- ByteFacetDescriptionElement.cs
- EnterpriseServicesHelper.cs
- Timer.cs
- ProxyHwnd.cs
- ExpandCollapsePattern.cs
- BaseDataListComponentEditor.cs
- DeriveBytes.cs
- XmlEncoding.cs
- ISCIIEncoding.cs
- HotSpotCollectionEditor.cs
- Missing.cs
- XmlQueryType.cs
- NotImplementedException.cs
- TextSpan.cs
- TextDecorations.cs
- CapiHashAlgorithm.cs
- WaitingCursor.cs
- UTF8Encoding.cs
- ClientProxyGenerator.cs
- _ConnectionGroup.cs
- DrawingAttributes.cs
- CellConstant.cs
- StatusBarPanelClickEvent.cs
- Membership.cs
- KeyedHashAlgorithm.cs
- StructuredProperty.cs
- PanelStyle.cs
- SerializationInfoEnumerator.cs
- SevenBitStream.cs
- DesignerActionUI.cs
- WebHeaderCollection.cs
- SecurityContextTokenCache.cs
- Paragraph.cs
- Pen.cs
- XmlImplementation.cs
- UserNamePasswordValidator.cs
- TextEncodedRawTextWriter.cs
- ImageMap.cs
- XmlTypeAttribute.cs
- MsmqSecureHashAlgorithm.cs
- RIPEMD160Managed.cs
- TagPrefixInfo.cs
- DataChangedEventManager.cs
- FragmentNavigationEventArgs.cs
- MenuItemAutomationPeer.cs
- Matrix.cs
- SqlNotificationRequest.cs
- DateTimeConverter2.cs
- SqlGatherProducedAliases.cs
- xdrvalidator.cs
- OleDbCommand.cs
- NetworkAddressChange.cs
- PrimitiveCodeDomSerializer.cs
- WorkflowInstanceContextProvider.cs
- CubicEase.cs
- RecordManager.cs
- QueryGeneratorBase.cs
- ValuePattern.cs
- Rect.cs
- DefaultWorkflowSchedulerService.cs
- ProxyElement.cs
- CryptoConfig.cs