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 / 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. // //[....] //----------------------------------------------------------------------------- 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.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- SafeFileMappingHandle.cs
- SafeNativeMethods.cs
- CqlGenerator.cs
- WindowsContainer.cs
- WindowsTab.cs
- IConvertible.cs
- MdImport.cs
- Geometry.cs
- SmiRequestExecutor.cs
- DataComponentMethodGenerator.cs
- ProfileBuildProvider.cs
- StaticFileHandler.cs
- MimeReflector.cs
- ListViewTableCell.cs
- XmlReflectionMember.cs
- DataReceivedEventArgs.cs
- DefaultSerializationProviderAttribute.cs
- DecimalKeyFrameCollection.cs
- TextPointerBase.cs
- CodeSubDirectory.cs
- DoubleCollectionConverter.cs
- ReferencedType.cs
- EventsTab.cs
- WorkItem.cs
- NamedPipeAppDomainProtocolHandler.cs
- AppSettingsExpressionBuilder.cs
- Visual3D.cs
- AnnotationHighlightLayer.cs
- CodeTypeParameterCollection.cs
- XPathArrayIterator.cs
- SkinBuilder.cs
- LogRecordSequence.cs
- DbParameterCollectionHelper.cs
- DataGridViewLinkColumn.cs
- CounterSampleCalculator.cs
- UpdatePanelTrigger.cs
- ToolStripSplitStackLayout.cs
- Latin1Encoding.cs
- FacetValueContainer.cs
- InvokeFunc.cs
- EventHandlersStore.cs
- TaiwanCalendar.cs
- CompositeCollectionView.cs
- TypeUtil.cs
- CalendarModeChangedEventArgs.cs
- BlurBitmapEffect.cs
- FutureFactory.cs
- ArrayMergeHelper.cs
- SimpleHandlerFactory.cs
- XmlQualifiedName.cs
- ShaderEffect.cs
- ListQueryResults.cs
- RadioButtonRenderer.cs
- NonceToken.cs
- WsdlBuildProvider.cs
- IISUnsafeMethods.cs
- NumberFormatInfo.cs
- BoolExpressionVisitors.cs
- FontCacheUtil.cs
- CodeParameterDeclarationExpression.cs
- Publisher.cs
- CustomErrorsSection.cs
- SQLString.cs
- PropertyManager.cs
- LinkedDataMemberFieldEditor.cs
- DocumentXPathNavigator.cs
- Section.cs
- RijndaelManaged.cs
- WorkflowViewService.cs
- HttpListenerException.cs
- EntityTypeEmitter.cs
- OptimizedTemplateContent.cs
- TrimSurroundingWhitespaceAttribute.cs
- DataShape.cs
- TextTreeTextElementNode.cs
- Attributes.cs
- PointCollectionValueSerializer.cs
- OwnerDrawPropertyBag.cs
- ReturnValue.cs
- TextServicesHost.cs
- InkPresenter.cs
- ReflectionUtil.cs
- MarkerProperties.cs
- TextOnlyOutput.cs
- FileEnumerator.cs
- Rect3DConverter.cs
- CodeDelegateCreateExpression.cs
- WindowShowOrOpenTracker.cs
- OrthographicCamera.cs
- GlobalizationSection.cs
- TypeElementCollection.cs
- TextFormattingConverter.cs
- RegistryDataKey.cs
- serverconfig.cs
- Evaluator.cs
- WebServiceClientProxyGenerator.cs
- GuidTagList.cs
- EntryPointNotFoundException.cs
- AssemblyHelper.cs
- MetadataSerializer.cs