You probably need to use cdata sections in your query. The term CDATA means, Character Data. CDATA is defined as blocks of text that are not parsed by the parser, but are otherwise recognized as markup. The predefined entities such as <, >, and & require typing and are generally difficult to read in the markup.
Following is the syntax for CDATA section −
<![CDATA[ characters with markup ]]>
You have to wrap your queries in CDATA as shown below −
<root> <query> <![CDATA[ select vbeln from vbpa where posnr > 50. ]]> </query> </root>
For more details about XML CDATA, you can refer below link −