How to set a namespace prefix programmatically with RmlMapper?

50 views Asked by At

When using Carml, I can define a namespace prefix in the RML file with:

carml:declaresNamespace [
      carml:namespacePrefix "tei";
      carml:namespaceName "http://www.tei-c.org/ns/1.0";
];

Reading the RmlMapper Github issues it seems that there is no equivalent (yet) in RmlMapper.

How to set a namespace prefix programmatically with RmlMapper?

Note:

In XMLRecordFactory, we see:

// Extract and register existing source namespaces into the XPath compiler
SaxNamespaceResolver.registerNamespaces(compiler, document);

And indeed, if I change my source XML from:

<TEI xmlns="http://www.tei-c.org/ns/1.0" xml:id="article_001">

to

<TEI xmlns="http://www.tei-c.org/ns/1.0" xmlns:tei="http://www.tei-c.org/ns/1.0" xml:id="article_001">

The namespace prefix is correctly defined for XPath. But I don't want to change all XML source files.

0

There are 0 answers