showing return of dataset.getAsHTML() in an info dialog

Hi,

I’m displaying the result of a dataset.getAsHTML() in a dialog, by the following code:

plugins.dialogs.showInfoDialog( 'details','<html>'+dataset.getAsHTML()+'</html>','OK')

and I’m running into the following problems:
1- If some of the values in the dataset contain ‘\n’ (line break), the displayed result in the dialog is as follows:

  • The first field is displayed as HTML (with a border around it)
  • All other information, including the added HTMl code ('s, 's etc) is displayed as text.
    I tried solving this by replacing the ‘\n’ by nothing, but this (offcourse) removes all linebreaks, of which some are really needed to display my results properly.

2- If a value in the dataset contains (valid) XML, this XML is not displayed properly. It seems like all tags are removed, just leaving the values.

I’m experiencing this with Servoy 2.2.5

Paul

Hi Paul,

You should replace the \n (not recognized as HTML) with
.

The xml is, as far as I know, not recognized by the Java html library. The only thing I can think of is replace the xml tags with valid html tags.

Hope this helps

I think the dataset values need to be escaped, before the values are inserted into the HTMl that is created by the getAsHTML() function.

will give the
thing a try (why didn’t I think of it… :? )

Paul

Tried it, but it doesn’t work, or should i say; doesn’t work properly.

When replacing \n by
, an extra (empty) column gets added after each column.

What i think needs to happen is that, in the getAsHTML() fucntion on datasets, the dataset values get escaped and linebreaks are replaced by
's

Paul

Hi Paul,

When replacing \n by
, an extra (empty) column gets added after each column.

That sounds really strange… It should work really!

It’s not strange, I think.

The html returned by getAsHTML() also contains “\n”, even if the values in the dataset do not contain “\n”.

This is because the HTML returned by getAsHTML() is sort of nicely formatted.

So, when I run a replace of “\n” by "
", this means extra
's are places between the normal HTML string, which then results in extra columns.

Paul