1

I tried running a gluon project that uses XML to initialize the project. Seeing the following error when running the application on an IOS device:

Caused by: java.lang.RuntimeException: XPathFactory#newInstance() failed to create an XPathFactory for the default object model: http://java.sun.com/jaxp/xpath/dom with the XPathFactoryConfigurationException: javax.xml.xpath.XPathFactoryConfigurationException: No XPathFactory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom at javax.xml.xpath.XPathFactory.newInstance(XPathFactory.java:76

Note: Application runs successfully on Desktop Windows/Mac and on Android platform.

Is the Xpath not supported on IOS devices with Gluon

4

1 回答 1

0

正如您在异常中所读到的:

No XPathFactory implementation found for the object model: http://java.sun.com/jaxp/xpath/dom at javax.xml.xpath.XPathFactory.newInstance...

所以你需要做的就是提供一个有效的实现。

例如,将此添加到您的 build.gradle:

dependencies {
    compile 'com.gluonhq:charm:4.4.0'
    compile 'xalan:xalan:2.7.2'
}

大概还有其他类似的'com.sun.org.apache:jaxp-ri:1.4'

我只为此代码尝试过:

public BasicView(String name) {
    super(name);

    XPath newXPath = XPathFactory.newInstance().newXPath();
}

而且我再也没有例外了。

于 2017-10-23T17:37:35.757 回答