Functions - xmlutils

fromJSON

Converts a JSON object to an XML representation.

fromTable

Converts a table to its XML representation.

fromJSON

(json? jsonValue, JsonOptions options)

returns xml | error

Converts a JSON object to an XML representation.

 json data = {
     name: "John",
     age: 30
 };
 xml|error xmlValue = xmlutils:fromJSON(data);

Parameters

  • jsonValue json?
  • The JSON source

  • options JsonOptions (default {})
  • The xmlutils:JsonOptions record for JSON to XML conversion properties

  • Return Type

    (xml | error)
  • XML representation of the given JSON if the JSON is successfully converted or else an error

fromTable

(table tableValue)

returns xml

Converts a table to its XML representation.

 type Employee record {
      int id;
      string name;
      float salary;
      boolean permanent;
  };
 table<Employee> tableValue = table[ { id: 1, name: "Mary",  salary: 300.5, permanent: true },
         { id: 2, name: "John",  salary: 300.5, permanent: true }
     ];
 xml xmlValue = xmlutils:fromTable(tableValue);

Parameters

  • tableValue table
  • The table value to be converted to an XML

  • Return Type

    (xml)
  • The XML representation of the provided table