Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / Xml / System / Xml / XmlResolver.cs / 1305376 / XmlResolver.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //[....] //----------------------------------------------------------------------------- namespace System.Xml { using System; using System.IO; using System.Text; using System.Security; using System.Security.Permissions; #if !SILVERLIGHT using System.Net; #endif using System.Runtime.Versioning; ////// /// public abstract class XmlResolver { ///Resolves external XML resources named by a Uniform /// Resource Identifier (URI). This class is ////// . /// /// public abstract Object GetEntity(Uri absoluteUri, string role, Type ofObjectToReturn); ///Maps a /// URI to an Object containing the actual resource. ////// /// #if !SILVERLIGHT [ResourceExposure(ResourceScope.Machine)] [ResourceConsumption(ResourceScope.Machine)] #endif public virtual Uri ResolveUri(Uri baseUri, string relativeUri) { if ( baseUri == null || ( !baseUri.IsAbsoluteUri && baseUri.OriginalString.Length == 0 ) ) { Uri uri = new Uri( relativeUri, UriKind.RelativeOrAbsolute ); #if !SILVERLIGHT // Path.GetFullPath is SecurityCritical if ( !uri.IsAbsoluteUri && uri.OriginalString.Length > 0 ) { uri = new Uri( Path.GetFullPath( relativeUri ) ); } #endif return uri; } else { if (relativeUri == null || relativeUri.Length == 0) { return baseUri; } // relative base Uri if ( !baseUri.IsAbsoluteUri ) { #if SILVERLIGHT // create temporary base for the relative URIs Uri tmpBaseUri = new Uri("tmp:///"); // create absolute base URI with the temporary base Uri absBaseUri = new Uri(tmpBaseUri, baseUri.OriginalString); // resolve the relative Uri into a new absolute URI Uri resolvedAbsUri = new Uri(absBaseUri, relativeUri); // make it relative by removing temporary base Uri resolvedRelUri = tmpBaseUri.MakeRelativeUri(resolvedAbsUri); return resolvedRelUri; #else throw new NotSupportedException(Res.GetString(Res.Xml_RelativeUriNotSupported)); #endif } return new Uri( baseUri, relativeUri ); } } #if !SILVERLIGHT //UE attension ///[To be supplied.] ////// /// public abstract ICredentials Credentials { set; } #endif public virtual bool SupportsType(Uri absoluteUri, Type type) { if (absoluteUri == null) { throw new ArgumentNullException("absoluteUri"); } if (type == null || type == typeof(Stream)) { return true; } return false; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.[To be supplied.] ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlSchemaValidationException.cs
- CookielessHelper.cs
- ImageDrawing.cs
- DataGridViewCellStyle.cs
- sitestring.cs
- NetSectionGroup.cs
- OleDbDataReader.cs
- WindowsToolbarItemAsMenuItem.cs
- AutoGeneratedFieldProperties.cs
- DataGridViewCellValueEventArgs.cs
- XmlSerializableServices.cs
- ThemeableAttribute.cs
- StorageMappingFragment.cs
- ChangeInterceptorAttribute.cs
- CreateUserErrorEventArgs.cs
- BitmapCodecInfo.cs
- Emitter.cs
- IncrementalHitTester.cs
- StyleTypedPropertyAttribute.cs
- CollectionChangedEventManager.cs
- IDictionary.cs
- TransformValueSerializer.cs
- EntityDataSourceViewSchema.cs
- datacache.cs
- ReflectEventDescriptor.cs
- SQLInt64.cs
- DelayedRegex.cs
- HandleRef.cs
- ExternalFile.cs
- TextTreePropertyUndoUnit.cs
- FullTextBreakpoint.cs
- RayHitTestParameters.cs
- GridViewItemAutomationPeer.cs
- BindableTemplateBuilder.cs
- TextElementEditingBehaviorAttribute.cs
- DesignerCapabilities.cs
- XmlObjectSerializerWriteContextComplex.cs
- WpfGeneratedKnownProperties.cs
- FileChangesMonitor.cs
- RemoveStoryboard.cs
- AsyncDataRequest.cs
- Function.cs
- CRYPTPROTECT_PROMPTSTRUCT.cs
- DateTimeFormatInfoScanner.cs
- SQLByte.cs
- XmlILOptimizerVisitor.cs
- Int64AnimationBase.cs
- ObjectDataSourceFilteringEventArgs.cs
- ConfigurationLocation.cs
- IconEditor.cs
- CustomValidator.cs
- DataGridCellsPanel.cs
- ToolStripContentPanel.cs
- Size.cs
- ListItem.cs
- RelationshipEnd.cs
- RotateTransform.cs
- DataListItemCollection.cs
- WebPartRestoreVerb.cs
- PreviousTrackingServiceAttribute.cs
- odbcmetadatafactory.cs
- ResolveNameEventArgs.cs
- DataProtection.cs
- URL.cs
- CharAnimationBase.cs
- PerfService.cs
- BitmapEffectOutputConnector.cs
- InputLangChangeRequestEvent.cs
- XmlAnyAttributeAttribute.cs
- CAGDesigner.cs
- DeobfuscatingStream.cs
- EventProviderTraceListener.cs
- HitTestParameters3D.cs
- Site.cs
- EditorPart.cs
- FormsAuthenticationTicket.cs
- PackageProperties.cs
- IntSecurity.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- SettingsPropertyValue.cs
- PolyBezierSegment.cs
- SecurityException.cs
- CqlParserHelpers.cs
- RenderingEventArgs.cs
- DiagnosticStrings.cs
- Point.cs
- ServerIdentity.cs
- Matrix.cs
- BatchWriter.cs
- MsmqIntegrationAppDomainProtocolHandler.cs
- webproxy.cs
- TreeWalker.cs
- ToolboxItemWrapper.cs
- MethodAccessException.cs
- SqlCommandBuilder.cs
- DataSourceViewSchemaConverter.cs
- FakeModelPropertyImpl.cs
- TypeReference.cs
- Thread.cs
- TypeSemantics.cs