Code:
/ 4.0 / 4.0 / 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.] ///// 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
- GcSettings.cs
- HandlerFactoryCache.cs
- StructuralType.cs
- MbpInfo.cs
- HtmlForm.cs
- PageAsyncTask.cs
- CodeTypeReferenceCollection.cs
- NumericUpDownAcceleration.cs
- ComponentDispatcherThread.cs
- SqlUserDefinedTypeAttribute.cs
- UndoManager.cs
- WsatRegistrationHeader.cs
- TextServicesPropertyRanges.cs
- ZoomPercentageConverter.cs
- DispatcherTimer.cs
- RoleGroup.cs
- TypeBrowser.xaml.cs
- PolyQuadraticBezierSegmentFigureLogic.cs
- ResourceProviderFactory.cs
- XmlTextReaderImpl.cs
- FontDifferentiator.cs
- StateWorkerRequest.cs
- SendMailErrorEventArgs.cs
- XmlBinaryReader.cs
- ProjectionQueryOptionExpression.cs
- SizeChangedEventArgs.cs
- XmlnsPrefixAttribute.cs
- SpinWait.cs
- CircleHotSpot.cs
- CallbackCorrelationInitializer.cs
- ObjectTokenCategory.cs
- BitmapMetadataBlob.cs
- WFItemsToSpacerVisibility.cs
- XomlSerializationHelpers.cs
- Bitmap.cs
- CodeTypeConstructor.cs
- Inline.cs
- SplitContainerDesigner.cs
- Button.cs
- TrackingExtract.cs
- FontStretch.cs
- FontFaceLayoutInfo.cs
- QuaternionIndependentAnimationStorage.cs
- CardSpaceSelector.cs
- RecognizedAudio.cs
- RegistrationServices.cs
- ExceptionHandlers.cs
- SHA512.cs
- DefinitionBase.cs
- RegexBoyerMoore.cs
- EUCJPEncoding.cs
- XmlEncodedRawTextWriter.cs
- InplaceBitmapMetadataWriter.cs
- ToolStripPanelSelectionGlyph.cs
- PictureBox.cs
- SecurityAttributeGenerationHelper.cs
- ListMarkerSourceInfo.cs
- WebPartConnectionsCloseVerb.cs
- COSERVERINFO.cs
- WebServiceParameterData.cs
- TypeValidationEventArgs.cs
- NameScopePropertyAttribute.cs
- Evaluator.cs
- XmlEntityReference.cs
- StateWorkerRequest.cs
- WindowVisualStateTracker.cs
- IISUnsafeMethods.cs
- Expression.cs
- ContractBase.cs
- ContentPropertyAttribute.cs
- DomainConstraint.cs
- ColumnWidthChangingEvent.cs
- DataGridRow.cs
- ApplicationSettingsBase.cs
- SymDocumentType.cs
- JsonCollectionDataContract.cs
- PartialList.cs
- PageParser.cs
- RelationshipEndMember.cs
- BrowserCapabilitiesCompiler.cs
- SingleStorage.cs
- RightsManagementEncryptionTransform.cs
- EntityCommandCompilationException.cs
- Parsers.cs
- SqlNode.cs
- CuspData.cs
- SimpleBitVector32.cs
- Binding.cs
- DataGridViewMethods.cs
- ValuePattern.cs
- ListControlDesigner.cs
- PermissionSet.cs
- XmlWriter.cs
- IPEndPoint.cs
- SerializerWriterEventHandlers.cs
- LinqDataSourceDisposeEventArgs.cs
- DataExpression.cs
- AlgoModule.cs
- FlowDocumentScrollViewer.cs
- dataprotectionpermissionattribute.cs