# Malformed XML

**URL:** <https://www.ruby-forum.com/t/malformed-xml/173973>\
**Category:** Rails\
**Created:** [August 18, 2009, 9:15pm UTC](https://www.ruby-forum.com/t/malformed-xml/173973 "2009-08-18T21:15:02Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@tim](https://www.ruby-forum.com/u/tim)\
**Post date:** [August 18, 2009, 9:15pm UTC](https://www.ruby-forum.com/t/malformed-xml/173973/1 "2009-08-18T21:15:02Z")

</div>

Hey all,

rails 2.1

When I do this from the controller:

render :xml =\> @address.errors, :status =\> :unprocessable\_entity

I get a malformed root node in the XML

\<active-record/errors type=“array”\> … \</active-record/errors\> #  
note the extra slashes

However when I do this in the console:

address.errors.to\_xml

I get the following which seems fine:

…

Any ideas on why the discrepancy and perhaps a fix for the controller  
bit?

Thanks in advance!  
Tim

---

<div class="post-metadata">

**Author:** ![tim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@tim](https://www.ruby-forum.com/u/tim)\
**Post date:** [August 19, 2009, 9:39pm UTC](https://www.ruby-forum.com/t/malformed-xml/173973/2 "2009-08-19T21:39:19Z")

</div>

Tim wrote:

> Hey all,
> 
> rails 2.1

…

> Any ideas on why the discrepancy and perhaps a fix for the controller  
> bit?

Odd. I just tried this out of curiosity in Rails 2.3.3 and it worked as  
expected:

\<?xml version="1.0" encoding="UTF-8"?\> Title can't be bland

A Rails 2.1 bug possibly??

---

<div class="post-metadata">

**Author:** ![tim](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ce73a5/32.png) [@tim](https://www.ruby-forum.com/u/tim)\
**Post date:** [August 19, 2009, 9:42pm UTC](https://www.ruby-forum.com/t/malformed-xml/173973/3 "2009-08-19T21:42:14Z")

</div>

Robert W. wrote:

> \<?xml version="1.0" encoding="UTF-8"?\> Title can't be bland

Obviously, titles must be interesting to be accepted. hehe. Sorry, I  
meant to type “blank.”

>
