# Why does this XmlMarkup return blank?

**URL:** <https://www.ruby-forum.com/t/why-does-this-xmlmarkup-return-blank/114632>\
**Category:** Rails\
**Created:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/why-does-this-xmlmarkup-return-blank/114632 "2007-09-17T13:23:20Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![yottameter](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/df705f/32.png) [@yottameter](https://www.ruby-forum.com/u/yottameter)\
**Post date:** [September 17, 2007, 1:23pm UTC](https://www.ruby-forum.com/t/why-does-this-xmlmarkup-return-blank/114632/1 "2007-09-17T13:23:20Z")

</div>

Both of these methods are in the controller. The method is called  
with /.xml;directory. The route completes, I get

XML Parsing Error: no element found  
Location: .xml;mytest  
Line Number 1, Column 1:

def mytest

```
respond_to do |format|
  format.html # index.rhtml
  format.xml { render :xml => try_xml_builder }
end

```

end

def try\_xml\_builder

```
xml = Builder::XmlMarkup.new(:indent=>2)
xml.instruct!
xml.person { |b| b.name("Jim"); b.phone("555-1234") }
return xml

```

end

If I override to\_xml with the same builder script in the mode,  
everything is great. There’s something wrong with the xml return value  
and render :xml, but I’m not sure what it is. The example for builder  
is from the builder pages, and returns the correct xml.

I’m running rails 1.2.2.
