acacia
acacia

Reputation: 1387

XML RuntimeError: Illegal character '&' in raw string?

I have a request that looks like this;

uri = URI.parse(url)
http = Net::HTTP.new(uri.host, uri.port)
request = Net::HTTP::Post.new(uri.request_uri)
request.body = purchase_xml
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
response = http.request(request)
result = Hash.from_xml(response.body)

However result = Hash.from_xml(response.body) gives me this error:

#<RuntimeError: Illegal character '&' in raw string "ybs_autocreate_status=ERROR&ybs_auto

Upvotes: 2

Views: 1548

Answers (1)

Kevin Ji
Kevin Ji

Reputation: 10499

Change any instances of & to &amp; when you are not referring to a character code.

Upvotes: 3

Related Questions