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

2

6

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
Elative answered 18/9, 2013 at 21:53 Comment(0)
E
15

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.

Elative answered 18/9, 2013 at 21:53 Comment(0)
K
1

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;" />
Kibitz answered 13/12, 2017 at 21:45 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.