How to convert XML String to XML Element in IBM BPM

Below post illustrates on how typecast an XML string to XML Element in IBM BPM.

I have recently encountered an issue of this sort in one of my projects.
Traditionally, below code snippet will work in converting an XML string to XML Element.

Where tw.local.xmlEleVar is of type tw.object.XMLElement and tw.local.xmlString.

But in later version of IBM BPM v8.0 (Starting from V8.0.1), the package used above seems to be deprecated. When the above snippet is used in ibm bpm v8.01 it started giving error. Then after some trail and error we found that the expression below, itself type casts the xmlstring to XMLElement.
tw.local.xmlEleVar = tw.local.xmlString