3

I'm using RABL to format the output of a Rails API I'm creating.

Is there anyway to customize the shape of the XML being produced? For instance, I need to produce an output that uses XML attributes, instead of elements. In other words, this...

<auth status="FAILED" errorcode="UNKNOWN_LOGIN" errormessage=”Error Message” />

Instead of this...

<auth>
   <status type="symbol">failed</status>
   <errorcode>UNKNOWN_LOGIN</errorcode>
   <errormessage>Invalid credentials.</errormessage>
</auth>

Any help will be highly appreciated?

mu is too short
  • 426,620
  • 70
  • 833
  • 800
Claudio Lassala
  • 271
  • 3
  • 15
  • I have pushed a repository that has an example of that: https://github.com/claudiolassala/api-samples I've ended up changing it to use ERB instead of RABL... I guess what I did isn't the Rails way of doing it, but it passes my test and gets the job done for now. I'd love to have somebody tell me what's the proper way of doing that, though. – Claudio Lassala Jul 24 '11 at 22:02

1 Answers1

1

I don't think rabl can support xml attributes, but the gem's author is very helpful. I would pose this question at the gem's git home page. https://github.com/nesquena/rabl/issues

RTIndy
  • 148
  • 5