ToXml Method

Official Content
This documentation is valid for:

Returns a string with the XML format of the SDT variable data. 

Syntax

A = B.ToXml(  [boolean IncludeHeader [boolean IncludeState] )


Type Returned:
String
 
Where:
A
    Attribute or variable string

B
    Variable based on SDT

boolean IncludeHeader
    Optional parameter: If true, then the returned string contains this header tag: "<?xml version = "1.0" encoding = "UTF-8"?>". The default value is false.

boolean IncludeState
    Optional parameter: It only applies to Business Components variables. If true, then the returned string contains the auxiliary variables (old values, mode, initialized flag). Otherwise, it only contains the record data. The default value is true.

Description

It is the opposite of FromXML. It returns an XML string with the data of the SDT.

Note: The ToXML method applied to SDTs which have a blob data type item results in an XML in which the blob is represented as a base64 string (SAC #30011)

Example

One of the possible content of the resulting string would be the following: 

<SDTName xmlns = “name_Kb”>
   <Name>Uruguay</Name>
   <Language>Spanish</Language>
   <Cordinating>
        <Latitude>30</Latitude>
        <Longitude>35</Longitude>
   </Cordinating >
   <Cities>
        <Item>Montevideo</Item>
        <Item>Paysandú</Item>
  </Cities>

Availability

Available since GeneXus X Evolution 2 Upgrade 2.

Scope

Objects: Procedures, Transactions, Web Panels
Languages: .NET, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)
Interfaces: Web 

See Also

FromXml Method
Structured Data Type (SDT) Object
Serialization of Business Components