2019 Dec 10 8:35 AM
Hello,
I have XML string + Simple Transformation like this:
... <tag1 att1="& lt; text"> ...
... <tt:cond><tt:attribute name="att1" value-ref="ATT1_VALUE"/></tt:cond> ...
And the problem is that after CALL TRANSFORMATION I get unescaped value in ABAP field:
ATT1_VALUE = "< text"
but I want:
ATT1_VALUE = "& lt; text"
Code example:
CALL TRANSFORMATION zsimple_transformation
SOURCE XML i_xml_string "UTF-8 string
Is there a easy way how to get value as it is (escaped)?
EDIT: There will be probably problem showing & lt ; (without spaces) and < in sap forum. I will edit afterwards and try add spaces. I hope you get what I mean...
2019 Dec 10 8:58 AM
What you get in the ABAP variable (< text) is not an error, it's actually the correct value, it corresponds "exactly" to what is in the XML.
If you want & lt; text in the ABAP variable, you have to change the original XML attribute value to & amp; lt; text or use <![CDATA[& lt; text]]>
Hello,
I have XML string + Simple Transformation like this:
... <tag1 att1="& lt; text"> ...
... <tt:cond><tt:attribute name="att1" value-ref="ATT1_VALUE"/></tt:cond> ...
And the problem is that after CALL TRANSFORMATION I get unescaped value in ABAP field:
ATT1_VALUE = "< text"
but I want:
ATT1_VALUE = "& lt; text"
Code example:
CALL TRANSFORMATION zsimple_transformation
SOURCE XML i_xml_string "UTF-8 string
Is there a easy way how to get value as it is (escaped)?
EDIT: There will be probably problem showing & lt ; (without spaces) and < in sap forum. I will edit afterwards and try add spaces. I hope you get what I mean...
2019 Dec 10 8:58 AM
What you get in the ABAP variable (< text) is not an error, it's actually the correct value, it corresponds "exactly" to what is in the XML.
If you want & lt; text in the ABAP variable, you have to change the original XML attribute value to & amp; lt; text or use <![CDATA[& lt; text]]>
2019 Dec 10 10:03 AM
sandra.rossi Thank you. You are right and I got to the same conclusion. If you please convert / copy it as an answer I will accept it 🙂
The value after TRANSFORMATION is correct and my problem is later in the process where we are sending this value in different XML (and there is actually missing escape XML value functionality, which makes second XML invalid).