ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Geometry Namespace / SpatialReference Class / ToXml Method
Example

In This Topic
    ToXml Method (SpatialReference)
    In This Topic
    Converts this spatial reference instance into an ArcGIS XML spatial reference representation.
    Syntax
    Public Function ToXml() As String
    public string ToXml()

    Return Value

    Spatial reference represented as an XML 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