cancel
Showing results for 
Search instead for 
Did you mean: 

Converting String to XMLDataType

Former Member
0 Kudos

As title, is there any way I can convert a String to XMLDataType?

I tried to assign it and I tried to type-cast it but it wouldn't let me do either one.

XMLDataType _XML;

String _stringXML = "<?xml version='1.0' ?> <text> Hello </text>";

_XML = _stringXML;

OR

_XML = (XMLDataType) _stringXML;

Thank you.

Accepted Solutions (0)

Answers (1)

Answers (1)

0 Kudos

Tim,

Just for clarification my assumption is that this is Java code inside of your custom action...

The XMLDataType is based off of the org.w3c.dom.Document class and can be created by the following:

String _stringXML = "<?xml version='1.0' ?> <text> Hello </text>";

Document w3Doc = XMLHandler.createDocument(_stringXML);

XMLDataType xmlDoc = new XMLDataType(w3Doc);

The XMLHandler class is located here:

com.sap.lhcommon.xml.XMLHandler;

Hope this helps.

Sam