# Base64 decoding and converting to xml

**URL:** <https://forum.kirupa.com/t/base64-decoding-and-converting-to-xml/328818>\
**Category:** web dev\
**Created:** [June 20, 2012, 6:14am UTC](https://forum.kirupa.com/t/base64-decoding-and-converting-to-xml/328818 "2012-06-20T06:14:56Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![nitinmukesh](https://avatars.discourse-cdn.com/v4/letter/n/7feea3/32.png) [@nitinmukesh](https://forum.kirupa.com/u/nitinmukesh)\
**Post date:** [June 20, 2012, 6:14am UTC](https://forum.kirupa.com/t/base64-decoding-and-converting-to-xml/328818/1 "2012-06-20T06:14:56Z")

</div>

Hi frnds,

I am working on a task where I have to convert the Flex application to HTML5.

I am stuck at the very first step where the Flex application is provided a Base64 encoded string and application converts it to xml. (The Base64 encoded string is XML)

Following is the code used in Flex

```php
Base64.toXML(unescape("eNrtXMmS28gRvfsraniyDyXWvky0egKrRhGa8XissA8TEx1YCmpYJNEGQG0n/4b/wt/gT"));

```

This is the function in Flex used to convert Base64 encoded string to XML.

```php

toXML(input:String, uncompress:Boolean = true):XML
{
    var xml:XML;
    var arr:ByteArray = Base64.decode(input);
    if(uncompress) arr.uncompress();
    arr.position = 0;
    xml = new XML(arr.readUTFBytes(arr.length))
    return xml;
}

```

I could find the base64Decode function in JQuery but how should I convert the decoded string to XML. I have been searching all over the net but could not find anything.

Any help is appreciated.
