开发者

Best practice to use multiple XML processors?

My project is using multiple implementations of XML processors (Java default, saxon 9, xerces 2). So, for x开发者_开发技巧ml processing I have to tell which class to load for DocumentBuilderFactory and XPathFactory etc.

We can do it in several ways as defined in Java docs. What is good practice for this:

  1. Use Constructor as introduced in Java 6 (Project already has dependency on Java 6)?
  2. Use the javax.xml.parsers.DocumentBuilderFactory/XPathFactory system properties?
  3. Use the properties file "lib/jaxp.properties" in the JRE directory?
  4. Use the Services API?


I'd go with option 1 as it's the least "magic". As an aside, last I checked the "Java default" XML parser was just a broken version of xerces.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜