# Issues with Ruby trying to parse data passed from Flex app

**URL:** <https://www.ruby-forum.com/t/issues-with-ruby-trying-to-parse-data-passed-from-flex-app/133134>\
**Category:** Ruby\
**Created:** [March 28, 2008, 6:37am UTC](https://www.ruby-forum.com/t/issues-with-ruby-trying-to-parse-data-passed-from-flex-app/133134 "2008-03-28T06:37:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajatgarg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a183cd/32.png) [@rajatgarg](https://www.ruby-forum.com/u/rajatgarg)\
**Post date:** [March 28, 2008, 6:37am UTC](https://www.ruby-forum.com/t/issues-with-ruby-trying-to-parse-data-passed-from-flex-app/133134/1 "2008-03-28T06:37:02Z")

</div>

Hi Guys,

I have a Ruby API that is getting called by a Flex app using POST. The  
problem is as long as data is in the format of -

user[name]=alsk  
user[email]=klsd  
user[pass]=03493

it is fine. But, when it has say two root elements like,

user[name]=alsk  
user[email]=klsd  
user[pass]=03493  
fc\_id =232

It will start crapping out with error messages like -  
Session ID: e3fe6e12eb9f685d82d87f413590efa9  
Parameters: {“format”=\>#\<Mime::Type:0xb797b21c @synonyms=[“text/xml”,  
“application/x-xml”], @symbol=:xml, @string=“application/xml”\>,  
“exception”=\>"#\<REXML::ParseException: malformed XML: missing tag  
start\nLine: \nPosition: \nLast 80 unconsumed characters:\n\<user[email]\>  
removed\_email\_address@domain.invalid\</user[email]\>\<user[first\_name]\>nuwan\</user[first\_nam\>\n/usr/local/lib/ruby/1.8/rexml/parsers/baseparser.rb:346:in  
`pull'\n/usr/local/lib/ruby/1.8/rexml/parsers/treeparser.rb:21:in `parse’\n/usr/local/lib/ruby/1.8/rexml/document.rb:190:in  
`build'\n/usr/local/lib/ruby/1.8/rexml/document.rb:45:in `initialize’\n/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/vendor/xml\_simple.rb:952:in

What is the problem? Can I only pass 1 record with a set of values or  
can I  
pass two records. Same thing works for GET.

Please advise.

## Thx,

Rajat G.

Ph: 206-499-9495  
Add: 1314 Spring Street, #412  
Seattle, WA 98104  
Web: [http://www.pilotoutlook.com](http://www.pilotoutlook.com)

---

<div class="post-metadata">

**Author:** ![rajatgarg](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/r/a183cd/32.png) [@rajatgarg](https://www.ruby-forum.com/u/rajatgarg)\
**Post date:** [March 28, 2008, 8:32am UTC](https://www.ruby-forum.com/t/issues-with-ruby-trying-to-parse-data-passed-from-flex-app/133134/2 "2008-03-28T08:32:24Z")

</div>

On Fri, Mar 28, 2008 at 6:36 AM, Rajat G. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> start\nLine: \nPosition: \nLast 80 unconsumed characters:\n\<user[email]\>  
> removed\_email\_address@domain.invalid\</user[email]\>\<user[first\_name]\>nuwan\</user[first\_nam\>\n/usr/local/lib/ruby/1.8/rexml/parsers/baseparser.rb:346:in  
> `pull'\n/usr/local/lib/ruby/1.8/rexml/parsers/treeparser.rb:21:in `parse’\n/usr/local/lib/ruby/1.8/rexml/document.rb:190:in  
> `build'\n/usr/local/lib/ruby/1.8/rexml/document.rb:45:in `initialize’\n/usr/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active\_support/vendor/xml\_simple.rb:952:in
> 
> What is the problem? Can I only pass 1 record with a set of values or can I  
> pass two records. Same thing works for GET.

The error message is about malformed XML. Maybe you could look at the  
xml source to see what’s wrong.  
For example - there’s \</user[first\_nam\> tag that seems wrong.

Other than that, it would help if you specify what framework are you  
using (rails, active webservice, etc.)

- this doesn’t look like a plain POST request since XML somehow got  
into processing…
