Note that there are some explanatory texts on larger screens.

plurals
  1. POCatching XML response using Nokogiri
    primarykey
    data
    text
    <p>I am trying a functionality where I am getting a XML response for success(one message) &amp; failure(multiple response messages) but I am not able to catch those messages in my rails code using nokogiri following are the messages I am getting in terms of XML response </p> <p>For failure (I can get other failure message too)</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;status&gt; &lt;error&gt; Such username is allready taken &lt;/error&gt; &lt;/status&gt; </code></pre> <p>For success(This is the only response)</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt; &lt;status&gt; &lt;success&gt;Registration succesful&lt;/success&gt; &lt;/status&gt; </code></pre> <p>In my code I am trying to do the following </p> <pre><code>def create @user = User.new(params[:user]) a = "https://www.example.com" url = URI.parse(a) http = Net::HTTP.new( url.host, url.port ) http.use_ssl = true if url.port == 443 http.verify_mode = OpenSSL::SSL::VERIFY_NONE if url.port == 443 path = url.path + "?" + "request_query" res, data = http.get( path ) case res when Net::HTTPSuccess, Net::HTTPRedirection doc = Nokogiri::XML(data) doc.xpath('/status/success').each do |link| @abc = link.content end flash[:notice] = @abc if @abc == 'Registration successful' flash[:notice] = "Registration successful" redirect_to "/" else doc.xpath('/status/error').each do |link| @err = link.content end flash[:notice] = @err render "new" end end </code></pre> <p>Any one if have any Idea will save my day.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload