theSemenov
theSemenov

Reputation: 477

Inner html in vaadin clara

I am using vaadin clara for build UI.
1. When I use this construction:

<?xml version="1.0" encoding="UTF-8"?>
<VerticalLayout xmlns="urn:import:com.vaadin.ui" xmlns:p="urn:vaadin:parent"  defaultComponentAlignment="MIDDLE_CENTER">
        <Label caption=<![CDATA[<b>Register</b>]]> contentMode="HTML" width=""></Label>
        <Form>
            <TextField id="name" caption="Name"></TextField>
            <TextField id="login" caption="E-mail"></TextField>
            <PasswordField id="password" caption="Pass"></PasswordField>
            <PasswordField id="password-check" caption="Pass check"></PasswordField>
        </Form>
        <HorizontalLayout>
            <Button id="register-button" caption="Register"></Button>
            <Button id="login-button" caption="Login"></Button>
        </HorizontalLayout>
</VerticalLayout>

I have error:

HTTP Status 500 - com.vaadin.server.ServiceException: org.vaadin.teemu.clara.inflater.LayoutInflaterException: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 18; Open quote is expected for attribute "{1}" associated with an element type "caption".


2. If I use construction like this:

...
<Label caption="<b>Register</b>" contentMode="HTML" width=""></Label>
...

I have error:

HTTP Status 500 - com.vaadin.server.ServiceException: org.vaadin.teemu.clara.inflater.LayoutInflaterException: org.xml.sax.SAXParseException; lineNumber: 3; columnNumber: 19; The value of attribute "caption" associated with an element type "null" must not contain the '<' character.<br>


3. If I use label without inner html, the code work fine.

...
<Label caption="Register" contentMode="HTML" width=""></Label>
...

My question is how to use inner html in vaadin clara framework. Thanks.

Upvotes: 0

Views: 614

Answers (1)

cfrick
cfrick

Reputation: 37063

You have to quote/escape the HTML. In your case it would be: &lt;b&gt;Register&lt;/b&gt;. The XML must be valid. A good editor or IDE would have warned you about this or could even to the escaping for you.

Upvotes: 1

Related Questions