Parses an XML string into a .NET object.

This method requires that you provide either .NET type object, or a fully qualified type name (namespace.classname or fully qualified GAC name).



Xml String. Should be in same format as data returned from ToXml()

The type of the object to be deserialized into. Accepts a .NET Type object (use GetType or GetTypeFromName) or a fully qualified class name (Namespace.Class)


XML must be in the same format as what ToXml() creates.

<?xml version="1.0" encoding="utf-8"?>
<TestCustomer xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
      <Street>32 Kaiea</Street>

The XML header is not required. If types are simple and well known the namespaces may also not required.


loBridge = GetwwDotnetBridge()

*** Create XML
loCust = loBridge.CreateInstance("Westwind.WebConnection.TestCustomer")
loCust.Name = "Rick"
loCust.Company = "Westwind"
loCust.Number = 100.21
loCust.Entered = DATETIME()
loCust.Address.Street = "32 Kaiea Place"
loCust.Address.City = "Paia"

*** Serialize to XML string
lcXml = loBridge.ToXml(loCust)
? lcXml
loCust = null

*** Deserialize back to object
loCust2 = loBridge.FromXml(lcXml,"Westwind.WebConnection.TestCustomer")
? loBridge.cErrorMsg
? loCust2.Company 
? loCust2.Address.City

See also:

Class wwDotNetBridge | wwDotNetBridge::ToXml | wwDotNetBridge::FromJson | wwDotNetBridge::ToJson

© West Wind Technologies, 1996-2024 • Updated: 06/07/17
Comment or report problem with topic