libCellML: Two Ways to Write One Import Location

Platform: libCellML · Type: Finding / imports · Status: Open, waiting for a reply (commented October 30, 2026) · Issue: #303 · Comment: on #303

Context

A CellML model can import units and components from another file. The xlink:href attribute on an import element says where that file is.

Rule 2.2.1.1 of the CellML 2.0 specification asks for "a valid locator href", as defined by the XLink specification, and the specification's reference is XLink 1.1.

The Issue

A member of the libCellML team opened issue #303 in 2019, after adding a check for href values. It asked two questions: how strict should the check be, and is %-escaping (writing a space as %20) allowed? The issue was still open.

What I Found

In XLink 1.1, an href is a Legacy extended IRI (LEIRI). A LEIRI may hold characters such as a space as they are, and becomes a URI by percent-encoding them. So the answer to both questions is yes: %20 is allowed, and so is a plain space.

With libCellML 0.7.2, two valid imports of the same file, library copy.cellml, get opposite results:

The href Importer Validator
../imported/library copy.cellml Opens the file Reports an invalid URI in the xlink:href attribute
../imported/library%20copy.cellml Reports that the file could not be opened Accepts it

Each part is reasonable on its own, but they read the address by different rules. The Validator passes the href to libxml2's xmlParseURI(), which expects a URI rather than a LEIRI. The Importer joins the href to the base path exactly as it is written (resolvePath() in src/importer.cpp), so %20 is never decoded into a space.

My Contribution

I answered on issue #303 itself, since it already asks these questions. The comment gives the XLink 1.1 reference, the table above, where each result comes from in the source, and links to the two test files in my conformance corpus. It ends with an offer to add tests for both cases.

Process

What's Next

If the maintainers would like tests for these two cases, I'll write them. When I later gathered the rest of my libCellML findings into one issue, #1517, this one was named there rather than repeated.

Reflection

The same file, written in two ways the standard allows, got opposite answers from two parts of the same library. Neither part is wrong by its own rules. This kind of quiet disagreement is exactly what the conformance corpus is for: it puts both ways side by side, so the difference can't hide.