ruby - How to insert XML into another XML file ( REST API ) -


i need pass application uses rest api parameters in following xml file

paramvalue = "<tag><stillonetag>value</stillonetag></tag>" xmlin = '  <?xml version="1.0" encoding="windows-1251"?>  <vco:execution-context xmlns:vco="http://www.vmware.com/vco" xmlns="vco">      <vco:parameters>          <vco:parameter name="inputxml" type="string" description="" scope="local">                   <vco:string>#{paramvalue}</vco:string>          </vco:parameter>       </vco:parameters>  </vco:execution-context> ' xmlexec = xmlin.gsub(/\>[\s\n\r]+\</, '><') response = httparty.post("/workflows/#{id}/presentation/instances/", { :basic_auth => @auth, :body => xmlexec}) 

with "normal" strings not have issues, in case parameter inputxml expects value xml string. how can embed such xml string ruby constant above? many in advance.

got it!!!! pass xml text value xml tag inside of xml object without making part of object

   need use &lt; , &gt; instead of < , >. 

in example should be

   paramvalue = "&lt;tag>&lt;stillonetag&gt;value&lt;/stillonetag&gt;&lt;/tag&gt;" 

so long, xml experts!


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -