adolfintel/WaifUPnP

Android compatibility

XJIOP opened this issue · 1 comments

XJIOP commented

This piece of code is not compatible with Android. Do I need some libraries? or is there any other solution?

import org.w3c.dom.traversal.DocumentTraversal;
import org.w3c.dom.traversal.NodeFilter;
import org.w3c.dom.traversal.NodeIterator;

        NodeIterator iter = ((DocumentTraversal) d).createNodeIterator(d.getDocumentElement(), NodeFilter.SHOW_ELEMENT, null, true);
        Node n;
        while ((n = iter.nextNode()) != null) {
            try {
                if (n.getFirstChild().getNodeType() == Node.TEXT_NODE) {
                    ret.put(n.getNodeName(), n.getTextContent());
                }
            } catch (Throwable t) {
            }
        }
XJIOP commented

I found a solution

need add to app build.gradle
implementation 'xerces:xercesImpl:2.11.0'

now org.w3c.dom.traversal has been successfully imported