ArcGIS Explorer Component Help |
Viewpoint..::.ToXmlString Method |
Viewpoint Class Example See Also |
Helper method to serialize an object to its XML representation, used to serialize an object to pass to a worker thread.
Namespace:
ESRI.ArcGISExplorer.MappingAssembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
Return Value
An XML string based on the state of the object.Remarks
The CreateFromXmlString and ToXmlString methods are provided as helper methods to make the code for serializing and deserializing ArcGIS Explorer objects simpler than comparable code using the .NET framework IXmlSerializable interface (although the IXmlSerializable interface is available if you wish to use it).
Serialization of ArcGIS Explorer objects xml is used in a number of situations; when saving a map, and also when passing objects between the UI thread and a background worker thread.
Examples
This method demonstrates the simplest way to serialize and deserialize an Explorer
object to an XML string, by using the ToXmlString and CreateFromXmlString methods.
CopyC#
// Create a new Point and serialize it to an XML representation. ESRI.ArcGISExplorer.Geometry.Point ptObject1 = new ESRI.ArcGISExplorer.Geometry.Point(); string ptXml = ptObject1.ToXmlString(); // Create a second Point by deserializing the XML string to a new object. ESRI.ArcGISExplorer.Geometry.Point ptObject2 = ESRI.ArcGISExplorer.Geometry.Point.CreateFromXmlString(ptXml);
CopyVB.NET
' Create a new Point and serialize it to an XML representation. Dim ptObject1 As ESRI.ArcGISExplorer.Geometry.Point = New ESRI.ArcGISExplorer.Geometry.Point() Dim ptXml As String = ptObject1.ToXmlString() ' Create a second Point by deserializing the XML string to a new object. Dim ptObject2 As ESRI.ArcGISExplorer.Geometry.Point = ESRI.ArcGISExplorer.Geometry.Point.CreateFromXmlString(ptXml)
Exceptions
Exception | Condition |
---|---|
ESRI.ArcGISExplorer..::.ExplorerException | Cannot serialize a CoordinateSystem with an Id of Zero. Coordinate systems must have a valid Id property indicating a standard (non-custom) coordinate system definition, in order to be serialized. |