mlreportgen.dom.MessageEventData class

Package: mlreportgen.dom

Holds message triggering message event


Contains the message that triggered a message event.


messageEventDataObj = MessageEventData(msg) creates a message event data object that contains a DOM message (for example, a message of type mlreportgen.dom.ProgressMessage).

The DOM message dispatcher attaches an object of this type to a message event when it dispatches a message. This enables message event listeners to retrieve the dispatched message. You need to create instances of this type only if you want to create your own message dispatcher.

Input Arguments

expand all

A message object, such as an mlreportgen.dom.ProgressMessage object, that triggers a message event.

Output Arguments

expand all

Container for message triggering message event data, represented by an mlreportgen.dom.MessageEventData object.


expand all

ID for this document element, specified as a character vector. The DOM generates a session-unique ID when it creates the document element. You can specify your own ID.

The value of this read-only property is a DOM message object, such as an mlreportgen.dom.ProgressMessage object, that triggers a message event.

Tag for document element, specified as a character vector.

A session-unique ID is generated as part of document element creation. The generated tag has the form CLASS:ID, where CLASS is the class of the element and ID is the value of the Id property of the object. You can specify a tag to replace the generated tag.

For example, to make it easier to identify where an issue occurred during document generation, you can specify your own tag value.


collapse all

When you add a dispatcher, the DOM API creates the evtdata object, which is an mlreportgen.dom.MessageEventData object.

import mlreportgen.dom.*;
doctype = 'html';
d = Document('test', doctype);
d.Tag = 'My report';
dispatcher = MessageDispatcher.getTheDispatcher;
l = addlistener(dispatcher, 'Message', ...
   @(src, evtdata) disp(evtdata.Message.formatAsText));
dispatch(dispatcher, ProgressMessage('starting chapter', d));
p = Paragraph('Chapter ');
p.Tag = 'chapter title';
p.Style = { CounterInc('chapter'), CounterReset('table'), WhiteSpace('pre') };
append(p, AutoNumber('chapter'));
append(d, p);
rptview('test', doctype);

Delete the listener to avoid duplicate reporting of message objects during a MATLAB® session.