Element consolidateMathMLNamespace(Element mathNode) throws MathConverterException {
        try {
            Document tempDoc;
            if (isNsAware(mathNode)) {
                tempDoc = mathNode.getOwnerDocument();
            } else {
                tempDoc = XMLHelper.string2Doc(XMLHelper.printDocument(mathNode), true);
            }
            // rename namespaces and set a new default namespace
            new XmlNamespaceTranslator()
                    .setDefaultNamespace(DEFAULT_NAMESPACE)
                    .addTranslation("m", "http://www.w3.org/1998/Math/MathML")
                    .addTranslation("mml", "http://www.w3.org/1998/Math/MathML")
                    .translateNamespaces(tempDoc, "");
            Element root = (Element) tempDoc.getFirstChild();
            removeAttribute(root, "xmlns:mml");
            removeAttribute(root, "xmlns:m");

            return root;
        } catch (Exception e) {
            logger.error("namespace consolidation failed", e);
            throw new MathConverterException("namespace consolidation failed");
        }
    }
Element consolidateMathMLNamespace ( Element mathNode ) throws MathConverterException { try { Document tempDoc ; if ( isNsAware ( mathNode ) ) { tempDoc = mathNode . getOwnerDocument ( ) ; } else { tempDoc = XMLHelper . string2Doc ( XMLHelper . printDocument ( mathNode ) , true ) ; } new XmlNamespaceTranslator ( ) . setDefaultNamespace ( DEFAULT_NAMESPACE ) . addTranslation ( "m" , "http://www.w3.org/1998/Math/MathML" ) . addTranslation ( "mml" , "http://www.w3.org/1998/Math/MathML" ) . translateNamespaces ( tempDoc , "" ) ; Element root = ( Element ) tempDoc . getFirstChild ( ) ; removeAttribute ( root , "xmlns:mml" ) ; removeAttribute ( root , "xmlns:m" ) ; return root ; } catch ( Exception e ) { logger . error ( "namespace consolidation failed" , e ) ; throw new MathConverterException ( "namespace consolidation failed" ) ; } }
Should consolidate onto the default MathML namespace.

@param mathNode root element of the document
@return return the root element of a new document
@throws MathConverterException namespace consolidation failed