Salesforce

How Do I Handle XML Data Which is Base64 Encoded? (Magic xpa 3.x)

« Go Back

Information

 
Created ByKnowledge Migration User
Approval Process StatusPublished
Objective
Description

How Do I Handle XML Data Which is Base64 Encoded? (Magic xpa 3.x)

If you are using the XML Views, then Magic xpa will automatically convert Base64 data to/from the binary values to text, when the field is defined in the schema as “base64Binary”.

For example, here we added two base64 elements to our sample .xsd:

<xs:element name="Studio" minOccurs="0" maxOccurs="unbounded">

<xs:complexType>

<xs:sequence>

<xs:element name="name" type="xs:string"/>

<xs:element name="RTF" type="xs:base64Binary"/>

/xs:sequence>

<xs:attribute name="code" type="StudioCodeType" use="required"/>

When we use this to create an XML View, we get:

In this example, we are using the BLOB to store RTF text, but it could contain an image or anything else.

When we write to the RTF field and then store the XML, it looks something like this:

<Studio code="S001">

<name>Universal Studios</name>

<RTF>c2QgIGFzZGYgYWRmIGQKDWFkZiBhc2RmCg1hZHNmYXNkZmFkc2YKDWFzZCBmNZg==</RTF>

</Studio>


Magic xpa did all the work.

Note: Only one BLOB is allowed per XML View.

See also

The Online and Rich Client Samples projects (program XM14 and RXM14)

Reference
Attachment 
Attachment