Official Content

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

Syntax

CharacterAttOrVar = &VarBasedOnSDT.ToXml(  [boolean IncludeHeader [boolean IncludeState] )

Where:

CharacterAttOrVar
    Attribute or variable based on Character data type

&VarBasedOnSDT
    Variable based on an 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.

Type Returned:
Character

Scope

Generators: .NET, .NET Framework, Java, Ruby (up to GeneXus X Evolution 3), Visual FoxPro (up to GeneXus X Evolution 3)

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)

Samples

One of the possible contents 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.

See Also

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




Last update: February 2024 | © GeneXus. All rights reserved. GeneXus Powered by Globant