translateNamespacePrefixes

Type: Function

How to get translateNamespacePrefixes?

JavaScript

import translateNamespacePrefixes from 'fontoxml-dom-utils/src/translateNamespacePrefixes.js'

Change namespace prefixes of a node and all its descendants.

This can be used if a source of XML might not use the same namespace prefixes as the documents edited by Fonto.

While it is certainly possible to use a number of prefixes for a certain namespace uri, it might be better to stick to using same prefix everywhere.

The getPrefixForUri should return the prefix for an uri, for example html for http://www.w3.org/1999/xhtml if html elements should be serialized as html:div. If the prefix should be absent, return null to make all html elements 'div'.

Arguments

  1. node

    (Required)

    Type: Node

  2. getPrefixForUri

    (Required)

    Type: Function | NULL

    Get called with a namespace uri and the 'current' prefix

Returns

Type: Node