Search code examples
gwtescapinguibinder

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

Solution

  • 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.