Main Content

mlreportgen.dom.CustomAttribute Class

Namespace: mlreportgen.dom
Superclasses:

Custom element attribute

Description

Custom element attribute.

Construction

customAttributeObj = CustomAttribute creates an empty custom attribute.

customAttributeObj = CustomAttribute(name) creates an attribute having the specified name.

customAttributeObj = CustomAttribute(name,value) creates an attribute having the specified name and value.

Input Arguments

expand all

Attribute name, specified as a character vector or string scalar.

Attribute value, specified as a character vector or string scalar.

Output Arguments

expand all

Custom attribute, represented by an mlreportgen.dom.CustomAttribute object.

Properties

expand all

Document element name, specified as a character vector or string scalar.

Attributes:

NonCopyable
true

Data Types: char | string

Value of this attribute, specified as a character vector or string scalar.

Attributes:

NonCopyable
true

Data Types: char

Tag for the mlreportgen.dom.CustomAttribute object, specified as a character vector or string scalar. The DOM API generates a session-unique tag as part of the creation of this object. The generated tag has the form CLASS:ID, where CLASS is the object class and ID is the value of the Id property of the object. Specify your own tag value to help you identify where to look when an issue occurs during document generation.

Attributes:

NonCopyable
true

Data Types: char | string

Object identifier for the mlreportgen.dom.CustomAttribute object, specified as a character vector or string scalar. The DOM API generates a session-unique identifier when it creates the document element object. You can specify your own value for Id.

Attributes:

NonCopyable
true

Data Types: char | string

Examples

collapse all

This example shows how to define custom attributes and append them to an unordered list.

import mlreportgen.dom.*;
d = Document('test');

ul = UnorderedList();

li = ListItem('Owl');
li.CustomAttributes = {CustomAttribute('data-animal-type','bird')};
append(ul,li);      

li = ListItem('Salmon');
li.CustomAttributes = {CustomAttribute('data-animal-type','fish')};
append(ul,li);

li = ListItem('Tarantula');
li.CustomAttributes = {CustomAttribute('data-animal-type','spider')};

append(ul,li);
append(d,ul);

close(d);
rptview('test','html');