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
- BridgeDataRecord.cs
- FrameworkObject.cs
- TrustLevel.cs
- ISSmlParser.cs
- StateValidator.cs
- UserControlBuildProvider.cs
- InstanceStoreQueryResult.cs
- UrlRoutingModule.cs
- Verify.cs
- DataGridViewCheckBoxColumn.cs
- TextDecorationCollectionConverter.cs
- PrtTicket_Editor.cs
- Util.cs
- ProxyAssemblyNotLoadedException.cs
- EntityDataSourceReferenceGroup.cs
- UnsafeNativeMethods.cs
- CrossSiteScriptingValidation.cs
- CompilerScopeManager.cs
- LicenseContext.cs
- RuleInfoComparer.cs
- SQLDoubleStorage.cs
- DataGridToolTip.cs
- JsonWriter.cs
- CriticalExceptions.cs
- IntSecurity.cs
- TransformerTypeCollection.cs
- RegistrationServices.cs
- TypeGenericEnumerableViewSchema.cs
- SizeConverter.cs
- Geometry3D.cs
- MouseButtonEventArgs.cs
- BaseCollection.cs
- WebException.cs
- Pen.cs
- ButtonBase.cs
- XamlFigureLengthSerializer.cs
- RecognizedAudio.cs
- SizeAnimationClockResource.cs
- LiteralDesigner.cs
- TemplateBamlRecordReader.cs
- IndependentAnimationStorage.cs
- TaiwanLunisolarCalendar.cs
- BindingSourceDesigner.cs
- ContextQuery.cs
- FormViewPageEventArgs.cs
- Privilege.cs
- CodeCommentStatement.cs
- MaterialCollection.cs
- DataGridViewTextBoxEditingControl.cs
- Deserializer.cs
- EarlyBoundInfo.cs
- KeyboardInputProviderAcquireFocusEventArgs.cs
- ConnectionsZone.cs
- WebPermission.cs
- CodeDirectiveCollection.cs
- SessionParameter.cs
- PageVisual.cs
- ObjectFactoryCodeDomTreeGenerator.cs
- ResizingMessageFilter.cs
- AdapterSwitches.cs
- FontSizeConverter.cs
- ReferenceConverter.cs
- TTSEngineProxy.cs
- WindowsAuthenticationModule.cs
- GraphicsState.cs
- SafeEventLogReadHandle.cs
- DefaultTraceListener.cs
- SchemaNotation.cs
- InOutArgumentConverter.cs
- _SingleItemRequestCache.cs
- DataGridTextBox.cs
- AssociationSetMetadata.cs
- AlignmentXValidation.cs
- DesignerTransaction.cs
- DataRelation.cs
- TrackBarDesigner.cs
- AddressHeaderCollection.cs
- ControlSerializer.cs
- SQLSingleStorage.cs
- TextTrailingCharacterEllipsis.cs
- ToolboxComponentsCreatedEventArgs.cs
- AllMembershipCondition.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- DefaultMemberAttribute.cs
- SqlDataSourceFilteringEventArgs.cs
- XmlSchemaExporter.cs
- ApplicationException.cs
- IsolationInterop.cs
- SourceSwitch.cs
- KeyPullup.cs
- MultilineStringConverter.cs
- DockAndAnchorLayout.cs
- COM2Properties.cs
- TemplateNameScope.cs
- CategoryGridEntry.cs
- CollectionChangeEventArgs.cs
- GenericArgumentsUpdater.cs
- FixedSOMPageElement.cs
- ToolStripContentPanelDesigner.cs
- WindowsListViewSubItem.cs