↓ Skip to main content
Nested paper frames, each inside the next, a single element at the centre

MAML Basics — XML for Maximo Mobile

Your First Maximo Mobile App - This article is part of a series.
Part 2: This Article
MAML is written with angle brackets, so everyone reads it as HTML and starts to guess. Most of the guesses work, and that is exactly the problem with them. Two hours later something renders blank, the build said nothing about it, and there is no obvious reason why.

MAS 9.2 series framework 3.2.8xx around 250 elements

If you have not read the first post in this series, start there. This one assumes you can find your way around an app, and that you now have to change something inside it.

Every figure on this page is a snapshot of a 9.2-series install with a framework in the 3.2.8xx line. The demonstrations run in our Components Explorer, a small Maximo Mobile app we built for these articles, in the preview of our MAF editor. IBM ships a point release about every month, so the numbers move. The rules are the durable part, and your own system holds your own numbers.

Three ways MAML differs from HTML
#

The vocabulary is closed. HTML tolerates unknown tags, and MAML has a fixed registry of around 250 elements, so anything outside it fails the build. This is good news, because the set is knowable and a typo in a tag name is caught immediately.

Elements are components with behaviour. A MAML element compiles to a React component, and that component brings its own logic with it. <data-list> owns paging, search and selection, so you configure it instead of decorating it. Reaching for the CSS you would write around a styled <ul> is how people lose their first afternoon.

Data arrives by binding. You declare a datasource, and the elements pull values out of it through binding expressions in curly braces. The framework owns the render loop, so there is nothing there for you to write.

That last point changes how you read a file, because a MAML page holds two things side by side. One is a description of where the data comes from, and the other is a tree that describes what the screen looks like, with the bindings running as wires between the two halves.

A MAML page has a data half and a screen half, joined by bindings A MAML page has a data half and a screen half, joined by bindings
A MAML page has a data half and a screen half, joined by bindings

The vocabulary, in one table
#

The elements are grouped into categories, and you will spend nearly all of your time in the first five.

Read against a 9.2-series reference. The categories move a little with each release; the shape of the table is what lasts.

CategoryWhat lives here
Application structurethe app root, pages, features, header template
Layout and containerboxes, rows, grids, the things you nest
Form componentsfields, inputs, lookups, buttons
Display componentslabels, icons, images
List and tabledata lists, cards, tables, columns
Dialog and modaldialogs, drawers, flyouts
…and eight morenavigation, datasources, dashboards, charts, templates, system, utility

Form components alone carry well over a thousand attributes, and nobody memorises that. What you need is the shape of the thing, plus the habit of looking the details up when you need them.

The reference is incomplete, and it says so. Elements supplied by packages outside the core framework are missing from it. When an element exists in a shipped app and is absent from the reference, the app is right and the reference has a gap. The lvc-* family used by LINEARAPP is the example everybody meets first.

Anatomy of a page
#

Strip a page down to its bones and you always get the same three things: a datasource, a schema that says which attributes to fetch, and a UI tree that binds to them.

<page id="assetlist" path="/assetList" title="Assets"
      controller="./controllers/pages/AssetListPageController">

  <maximo-datasource id="assetListDS"
                     object-structure="mxapiasset"
                     order-by="assetnum"
                     page-size="25">
    <schema id="assetlist_schema">
      <attribute name="assetnum" id="at_num"/>
      <attribute name="description" id="at_desc"/>
      <attribute name="status" id="at_status"/>
    </schema>
  </maximo-datasource>

  <data-list id="dl_assets" datasource="assetListDS">
    <box id="bx_row" direction="column">
      <label id="lb_num"  label="{item.assetnum}"    theme="16-bold"/>
      <label id="lb_desc" label="{item.description}" theme="14-regular"/>
    </box>
  </data-list>

</page>

That fragment follows the element reference, which matters more here than it would anywhere else. An earlier version of this post used value= on the <label> elements. That is wrong, because <label> takes label and value belongs to input elements. A post about invalid MAML shipping quietly is a poor place to ship invalid MAML.

Four things in that snippet need an explanation, because they are the four things that beginners get wrong.

The schema is a fetch list. Attributes that you do not declare are never requested from the server, so a binding to one of them gives you nothing, and it does that silently.

id is mandatory and must be unique across the whole merged application, which is wider than the file. The build flattens every page together, and duplicate ids are a build error.

{item.…} inside a list means the current row. Outside a list you address the datasource by name instead, as {assetListDS.item.assetnum}.

A binding to something that does not exist renders empty. There is no error, no warning and no console message. This is by far the most common reason for a blank field.

Here is the fetch list and the silent blank at work, in our explorer against our test system. One Maximo datasource asks for assetnum, description and status of four pumps. The list on the left binds those three. The list on the right binds location in place of status. All four pumps have a location in Maximo, and the line still stays empty, because the schema never asked for it.

Maximo Mobile at tablet width, on the page “MAML: the schema is a fetch list”. Two lists of the same four pumps, 11430, 11450, 11470 and 11480. The left list, bound to status, shows three lines per pump: the number, the description and OPERATING or NOT READY. The right list, bound to location, shows only two lines per pump, the number and the description. Above them a label with theme 14-regular and color blue60, drawn in grey.
An attribute the schema never asked for renders as nothing, in Maximo Mobile at tablet width, in the preview of our MAF editor

The trap: warnings that ship
#

This is the point where MAML differs from every other markup language you have used, and it turns on one thing. The build has two completely different classes of complaint, and only one of them stops you.

mermaid diagram mermaid diagram

Errors stop the build, and warnings let it through, so invalid MAML ships with the app.

Errors stop you where you stand, and warnings let you walk straight past them. Invalid MAML compiles, bundles, publishes and runs. You find out when something looks wrong on a device, weeks later, and by then nobody remembers the warning that scrolled past during a build.

The highest-traffic example is text styling, where theme and color on a <label> are documented as two independent lists. Roughly twenty-five themes against thirty-five colours reads like eight hundred combinations. The real number is far smaller, because a theme limits which colours are permitted. The build enforces that rule, and the reference does not state it.

The build names the permitted colours itself, one theme at a time. We put a label with theme="14-regular" and color="blue60" into our explorer and built it. The build ended with exit code 0 and one warning: color="blue60" is an invalid color for theme="14-regular". Valid color(s): gray60. On screen the label drew in the theme’s grey, and the blue was dropped. The table below collects the permitted pairs.

For the 9.2 series. Check it against the build output of your own install before you rely on it.

themepermitted color values
36-lightgray80
28-lightgray80
28-regulargray80, white0
20-regulargray80, gray60, gray40, blue60, red60, white0
16-regulargray80, gray60, gray40, red60, white0
16-boldgray80, white0
14-regulargray60

Seven current themes, with between one and six colours each, and six distinct colours across the whole matrix. Everything else produces a warning, and that warning ships with your app instead of stopping it. Another fifteen themes are deprecated, which is where the next section starts.

IBM breaks this too
#

We checked the rule against IBM’s own shipped applications, partly to validate the table and partly out of curiosity. A wrong matrix would have flagged a flood of false violations, so the check works in both directions at once. Across the shipped apps:

  • Many <label> elements use a theme that is deprecated.
  • A small number use a theme and colour pair that is not valid.
  • A few could not be judged, because the colour was a binding expression.
Many of IBM’s own labels use a deprecated theme. So “I copied this from a shipped app” is no evidence that something is current. Copying MAML out of the shipped apps is a reasonable way to learn a pattern, and it is a poor way to choose a style.

How to protect yourself
#

Three habits, ordered by how much they will save you over the life of an app:

  • Read the build output. Read the whole output, the warnings included, and the exit code is only part of it. A successful build with a page of warnings is a problem that you have postponed.
  • Treat the combination rules as errors. Make them fail while you still have the file open. Our MAF editor names the label above in its problem list, with the permitted colour beside it. On an app that you inherited, take a baseline of the existing warnings first, or you will drown in findings that were there before you arrived. A list nobody can act on is a list everybody learns to ignore.
  • Build for the mobile target as well as the browser. The browser target is more permissive and silently skips checks that only apply on a device. An app that builds cleanly in a browser can still fail at publish time, and publish time is the slowest possible place to find out.

What to read next#

You can read a MAML file now, and you know which of its rules will let you down quietly. The next step is to build one of your own and watch the build output while it happens.

Next in this series: Hello World in Maximo Mobile. If you skipped it, Understanding Your First Maximo Mobile App maps the files this post assumes you can find.


The element reference IBM ships is available on your own MAS install. In the Application Configuration application, open the ? menu and choose Component Documentation. It documents every element and attribute individually, which is exactly why the combination rules above are worth having separately.

Your First Maximo Mobile App - This article is part of a series.
Part 2: This Article