ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / SpatialReferenceBuilder Class / FromXml Method
XML string representation of a SpatialReference.
Example

In This Topic
    FromXml Method (SpatialReferenceBuilder)
    In This Topic
    Creates a new instance of a SpatialReference class from an XML string representation.
    Syntax
    Public Shared Function FromXml( _
       ByVal xmlString As String _
    ) As SpatialReference
    public static SpatialReference FromXml( 
       string xmlString
    )

    Parameters

    xmlString
    XML string representation of a SpatialReference.

    Return Value

    Exceptions
    ExceptionDescription
    The xmlString is empty or null.
    XML is invalid or does not represent a spatial reference string.
    Example
    Import and Export Spatial Reference
    {
      SpatialReference srWithVertical = SpatialReferenceBuilder.CreateSpatialReference(4326, 6916);
    
      string xml = srWithVertical.ToXml();
      SpatialReference importedSR = SpatialReferenceBuilder.FromXml(xml);
      // importedSR.Wkid = 4326
      // importedSR.VcsWkid = 6916
    
      string json = srWithVertical.ToJson();
      importedSR = SpatialReferenceBuilder.FromJson(json);
      // importedSR.Wkid = 4326
      // importedSR.VcsWkid = 6916
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also