Friday, May 24, 2013

HTML widget eats first DIV in string input

This is odd and I am probably missing something simple but...

I am using GWT 2.5.1; Eclipse Juno (on Win 7) and target platform is a RedHat box

I have a RequestBuilder that makes a POST request and has a JSONObject returned.  This works.  The HTTP response returned to the RequestBuilder is:

Status: 200
Content-length: 22019
Content-Type: text/plain; charset=ISO-8859-1

{"result":{"future":[{"show":"<h4>Visht&egrave;n</h4>\n<div id=\"artistImage\"><img src=\"http://www.myDomain.com/concerts/2013/06/27/thumb.jpg\" alt=\"Photo of Vishten \" /><a href=\"http://www.vishten.net/en/index.htm\">www.vishten.net</a></div>\n<div id=\"venue\"><p><a href=\"http://www.place.org/\">The Place</a><br/>202 South Broadway Avenue</p>\r\n</div>\n","date":"2013-06-27 18:30:00"},{"show":"<h4>We Banjo 3</h4>\n<div id=\"artistImage\"><img src=\"http://www.myDomain.com/concerts/2013/08/06/thumb.jpg\" alt=\"photo of We Banjo 3\" /><a href=\"http://www.webanjo3.com/\">www.webanjo3.com/</a></div>\n<div id=\"venue\"><p>TBA</p></div>\n","date":"2013-08-06 20:00:00"},{"show":"<h4>Mick Conneely &amp; David Munnelly </h4>\n<div id=\"artistImage\"><img src=\"http://www.myDomain.com/concerts/2013/09/05/thumb.jpg\" alt=\"photo of David & Mick\" /><a href=\"http://davidmunnelly.com/david-munnelly-mick-conneely-press-kit\">davidmunnelly.com</a></div>\n<div id=\"venue\"><p>TBA</p></div>\n","date":"2013-09-05 20:00:00"},{"show":"<h4>Sarah McQuaid</h4>\n<div id=\"artistImage\"><img src=\"http://www.myDomain.com/concerts/2011/05/03/thumb.jpg\" alt=\"Photo of Sarah McQuaid\" title=\" Photo by Alastair Bruce (www.alastairbruce.co.uk)\" /><a href=\"http://www.sarahmcquaid.com/\">www.sarahmcquaid.com</a></div>\n<div id=\"venue\"><p><a href=\"http://www.place.org/\">The Place</a><br/>202 South Broadway Avenue</p></div>\n","date":"2013-10-01 20:00:00"},{"show":"<h4>Comas</h4>\n<div id=\"artistImage\"><img src=\"http://www.myDomain.com/concerts/2013/11/19/thumb.jpg\" alt=\"Photo of Comas\" /><a href=\"http://www.comasmusic.com/comas/index.html\">www.comasmusic.com</a></div>\n<div id=\"venue\"><p>TBA</p></div>\n","date":"2013-11-19 20:00:00"}]}}

This is slightly edited but shows the issue.  The response is an object that contains the "future" object.  Future contains an array of objects. Each array element is an object with two fields: show and date.  Date is an ISO standard date/time string and show is an HTML's string of info about a concert.

After the RequestBuilder returns, the object is passed to a method that displays the list of shows.  This is where the issue arises.  The content of each show element is put into an HTML widget.  Each HTML widget is added to a panel for display.

Here is one show that has been formatted for easier viewing:

{"show":
"<h4>Visht&egrave;n</h4>
<div id=\"artistImage\">
  <img src=\"http://www.myDomain.com/concerts/2013/06/27/thumb.jpg\" alt=\"Photo of Vishten \" />
  <a href=\"http://www.vishten.net/en/index.htm\">www.vishten.net</a>
</div>
<div id=\"venue\">
  <p><a href=\"http://www.place.org/\">The Place</a><br/>202 South Broadway Avenue</p>
</div>\n",
"date":"2013-06-27 18:30:00"}

So each show has more than one DIV and the first item is always an H4.

When JSONString/stringValue is passed into an HTML widget the rendered result is:

<h4>Visht&egrave;n</h4>
  <img src="http://www.myDomain.com/concerts/2013/06/27/thumb.jpg" alt="Photo of Vishten " />
  <a href="http://www.vishten.net/en/index.htm">www.vishten.net</a>
<div id="venue">
  <p><a href="http://www.place.org/">The Place</a><br/>202 South Broadway Avenue</p>
</div>

The first DIV tags are removed while the DIV content remains.

If I change the order of the DIVs the same thing happens to whichever DIV come first.

What am I missing?

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment