Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you use   in GWT UiBinder XML? Can you escape it?

In my mark-up I want to add a space ( ) between elements without always having to use CSS to do so. If I put   in my markup, GWT throws errors. Is there a way around it?

For example:

<g:Label>One&nbsp;</g:Label><g:Label>Two</g:Label>

Should show:

One Two

And not:

OneTwo
like image 514
11101101b Avatar asked Sep 18 '13 21:09

11101101b


People also ask

How do you use a semicolon?

Use a semicolon to join two related independent clauses in place of a comma and a coordinating conjunction (and, but, or, nor, for, so, yet). Make sure when you use the semicolon that the connection between the two independent clauses is clear without the coordinating conjunction.

How do you use a colon and semicolon?

Semicolons should introduce evidence or a reason for the preceding statement; for example, this sentence appropriately uses a semicolon. A colon, on the other hand, should be used for a stronger, more direct relationship. It should provide emphasis, an example, or an explanation.

What does a dot above a comma mean?

What Is a Semicolon? The semicolon is the colon's quirkier sibling. While the colon is simply two dots stacked : the semicolon is a dot hovering over a comma ; The semicolon does jobs that are also done by other punctuation marks, but puts its own spin on the task. Like a comma, it can separate elements in a series.


2 Answers

As documented here, you just have to add this to the top of your XML file and it will work!

<!DOCTYPE ui:UiBinder SYSTEM "http://dl.google.com/gwt/DTD/xhtml.ent">

Note that the GWT compiler won't actually visit this URL to fetch the file, because a copy of it is baked into the compiler. However, your IDE may fetch it.

like image 187
11101101b Avatar answered Oct 20 '22 21:10

11101101b


Rather than use a Label, which to me shouldn't allow character entities at all, I use an HTML widget. In order to set the content, though, I find I have to do it as the HTML attribute, not the body content (note that the uppercase HTML is important here, since the set method is setHTML, not setHtml)

<g:HTML HTML="One&amp;nbsp;" />
like image 24
stevec Avatar answered Oct 20 '22 23:10

stevec