# Convert stream (in hexadecimal format) back to XML-UTF8

**URL:** <https://forum.kirupa.com/t/convert-stream-in-hexadecimal-format-back-to-xml-utf8/325866>\
**Category:** flash\
**Created:** [November 9, 2011, 10:00am UTC](https://forum.kirupa.com/t/convert-stream-in-hexadecimal-format-back-to-xml-utf8/325866 "2011-11-09T10:00:51Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Forrest\_Gimp](https://avatars.discourse-cdn.com/v4/letter/f/7cd45c/32.png) [@Forrest\_Gimp](https://forum.kirupa.com/u/Forrest_Gimp)\
**Post date:** [November 9, 2011, 10:00am UTC](https://forum.kirupa.com/t/convert-stream-in-hexadecimal-format-back-to-xml-utf8/325866/1 "2011-11-09T10:00:51Z")

</div>

Hi

I have an XML which is sent to Flash. In Flash I want to use it as an XML-Object.  
So far so good.

The XML is however sent to flash as a String of hexadecimal values (as if you’d open the xml in a hex-editor). So the variable I receive in Flash looks like this:  
“3c3f786d6c2076657273696f6e3d22312e302220656e636f64696e673d225554462d3822207374616e64616c…” and so on and so on.

Any Ideas how I can convert this hex-string back to a useable XML-object?

So far I have tried to cast the string to a byteArray, and then read it, but no luck with that (inFile is the string):

```auto
        
public function bitesArray(inFile)
{
            trace("String = "+inFile); // traces out fine
            trace("Type of imput-data is "+getQualifiedClassName(inFile));// "String"
            trace("try interpreting as bitesArray");

            var stream = ByteArray(inFile);
            var testText = stream.readUTF();
            trace("Stream-decoding = "+testText); // no output for "testText"

            var castXmlFile = XML(testText);
            trace("Cast-XML = "+castXmlFile); // no output for "castXmlFile"
 }

```
