How to show formatted xml in vaadin 10?

In previous versions there was ContentMode.PREFORMATTEDPRETTY in label. Is where something like that in vaadin 10?

Any ideas?

Hi,

I don’t know exactly what is ContentMode.PREFORMATTEDPRETTY.
I found ContentMode.PREFORMATTED but not ContentMode.PREFORMATTEDPRETTY.

What do you want to display ?

You can do something like that:


import org.apache.commons.lang3.StringEscapeUtils;
..
..
        String myxml = "<xml>\n   <test>test</test>\n</xml>";
        Html html = new Html("<pre lang=\"xml\">"+StringEscapeUtils.escapeXml(myxml)+"</pre>");

Or you can use a editor like ace editor: https://vaadin.com/directory/component/juicyjuicy-ace-editor

To display pretty code (xml).