Syntax error in javax.xml.xpath.XPathFactory provider-configuration file of Saxon-HE 9.3

这一生的挚爱 提交于 2019-11-30 12:38:06

Michael Kay answered the question on a SourceForge forum. He said that:

The format of the file was chosen to circumvent a JDK5 bug.

And also that:

Actually, I wouldn't recommend using the JAXP search mechanism anyway. It's very slow, and it delivers an XPath engine that won't necessarily work with your application. You have no way of knowing whether you get an XPath 1.0 or 2.0 implementation back, and the API is so weakly defined that there's very little chance your application will work with a particular provider unless you have tested it with that provider first. So even without this bug, I would steer clear of it.

I think it answers the question even if it does not provide an explicit fix for the problem. So we could chose the implementation by writing:

XPathFactory xpf = XPathFactory.newInstance(
  XPathFactory.DEFAULT_OBJECT_MODEL_URI,
  "net.sf.saxon.xpath.XPathFactoryImpl",
  ClassLoader.getSystemClassLoader());

I know this is an older thread, but this post of mine might shed some light on the issue. It finds the XPathFactory using a -D parameter that I've never seen documented.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!