Displaying 14 results from an estimated 14 matches for "from_xml".
2009 May 09
0
XMLRPC raw_post getting run through Hash#from_xml
Im trying to create an api, and Im having trouble getting
ActionController to not run the raw post data through Hash#from_xml
(request.parse_formatted_request_parameters) for the XMLRPC post data.
I essentially want it to run through
XMLRPC::XMLParser::REXMLStreamParser.new.parseMethodCall(request.raw_post).
However, I can''t figure out a clever, clean way to get
request.request_parameters to not run since it ca...
2011 Mar 26
2
How to deserialize an array from XML
Hi,
to serialize an array to xml we can use:
an_array = [ 1, 2, 3]
an_array.to_xml
But to I can''t find a way to convert back XML to array. I didn''t find a
method Array.from_xml like Hash.from_xml.
Any ideas?
Thanks,
Gustavo
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this gro...
2010 Apr 05
2
Harmonizing JSON/XML serialization
...s a solved
issue in Rails 3:
https://rails.lighthouseapp.com/projects/8994/tickets/3812-collection-root-for-enumerable-to_json
But how is this being taken care of exactly? It seems like, for
consistency''s sake, we''d want the structure of JSON serialization to
be as close to Hash#from_xml''s output as possible. This is the state
of affairs with 3.0.0.beta2 (the last two expressions are the most
important for this discussion):
Loading development environment (Rails 3.0.0.beta2)
irb(main):001:0> foo = Thing.first
=> #<Thing id: 1, name: "foo">
irb(main):...
2009 Feb 03
3
ROXML from_xml not returning an object instance...
Hello,
I have two ActiveRecord classes. One is Route the other is Waypoints.
I have constructed an XML representation so I can use AJAX to create a
Route with all waypoints in a single create call to RouteController.
When I call Route.from_xml(xmlString) it is not returning an object -
it''s leaving the object (@route) nil, but not erroring. Any ideas?
Here''s some code:
RoutesController:
def create
@route = nil;
if params[:requestXML]
# unserialise from XML using ROXML
@route = Route.from_xml(pa...
2010 Aug 11
0
Hash.from_xml does not handle attributes as of rails3 beta4
Can anybody confirm whether or not this has been fixed in the rc releases?
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org
To unsubscribe from this group, send email to
2007 Jul 18
2
Hash.from_xml
Hi,
I''ve started looking at ticket
90<http://merb.devjavu.com/projects/merb/ticket/90>and there are a
couple of situations that the current implementation doesn''t
cater for.
1. Tag Attributes are wiped out.
- <tag1 attr1=''1''>Content</tag1> #=> { "tag1" => "Content" }
- I think it should return
-
2009 Jan 05
5
ROXML versus simple to_xml
How they differ?
Does the to_xml method of the classes array/hash/object is based on
ROXML lib?
As I see in http://roxml.rubyforge.org/#quickstart, roxml needs we
define the class (class Book in the guide) before to convert a object
to xml. Moreover, the method to_xml (when not using "include ROXML")
just accepts any existing object, what is much suitable.
I need to compare and tranfer
2007 Sep 04
11
returning(...) ?
The following construct is an ActiveSupport-ism:
returning(Foo.new) do |foo|
...
end
I don''t especially like it, since it''s both more verbose and less efficient
than the direct alternative:
foo = Foo.new
...
foo
It doesn''t occur many times in Merb, so does anyone agree with me that it
should be removed?
I tried doing this (patch attached) and I find
2007 Sep 21
1
RESTful route gives a 500 error when Content-Type is set
...ied several days ago as well and had the same results.
The following trace is in the logs:
Request: REQUEST_URI: /people/test.xml (2007-09-21 11:13:31)
undefined method `to_hash'' for nil:NilClass - (NoMethodError)
/usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/core_ext/hash.rb:265:in
`from_xml''
/usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/core_ext/hash.rb:67:in
`from_xml''
/usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/request.rb:83:in `xml_params''
/usr/lib/ruby/gems/1.8/gems/merb-0.4.0/lib/merb/request.rb:96:in `params''
/usr/lib/ruby/gems/1.8/gems/...
2007 Feb 23
4
How can I spec this? The method gets passed a block...
I''m using Jim Weirich''s Builder library. The code I want to spec is
xml.video do
xml.id @video_id
xml.views @views
xml.date(@date.to_s) if @date
end
I''d like to mock it, rather than asserting that the XML is the right
string. I can do one spec:
specify "should create a video tag" do
@mock_builder.should_receive(:video)
2008 May 24
1
to_xml for Foo::Bar active records
20 / 20 hind sight, I would probably do things different today but I
have most of my active record classes under different parent classes.
For example:
module Foo
class Bar < ActiveRecord::Base
...
end
end
The to_xml for this produces <foo/bar> .... </foo/bar>
The / in a tag name is not allowed. Questions:
1) Is this a bug?
2) If so, suggestion of what to convert it to?
2007 Mar 28
7
Rails, REST and JSON
Hi everyone,
I''m writing a lightweight AJAX application using Rails on the server side as
a RESTful web service provider.
I need the web service to support both JSON and XML I/O. Outputting data in
XML and JSON is easy (using to_xml and to_json),
and it''s also easy to do XML input as Rails does it for you automatically.
Is it possible to somehow have the same
automatic parsing
2007 Mar 24
15
State Based vs. Behaviour Based Spec/Testing
I''ve notice that a project like Rubinius has both a spec & a test
directory. Rspec has only a spec directory. Obviously I support
BDD, but isn''t there also a place for state based/verification
testing? I sometimes sense that I *do* want to practice Test Driven
Development. That is, I want some assurance that my production code
will run as intended. But I also
2007 Sep 07
12
Preconditions
Sorry, lots of questions these days.
Is there a normal approach for preconditions? In JUnit, I might put a few
assertions in the setUp() just to make sure that the test ''data'' I''ve
created meets expectations before going to test it.
So, for instance, I''ve got an object that is audited using acts_as_audited
and I''d like to test the XML that results