Hello,

our web application is built by Maven2.
It's transitive dependencies include dom4j (1.6.1).

The dependencies of dom4j include multiple XML parser 
implementations, namely:

pull-parser 2
xpp3 1.1.3.3

My application also uses Xerces.

When the application starts, some of the libraries (Struts)
attempts to instatiate an XML parser. 
At the application startup, the parser implementation is selected using
the JAR-Services API (META-INF/services).

The problem is that the concrete implementation is selected (found)
randomly by the class-loader. There is no guarantee, that the class-loader 
selects 
the correct parser. In our case, we need a validating parser (Xerces).

One possible solution is to set a system property, that would point to the
desired parser implementation class. We do not want to use a system property, 
since it influences the whole JVM.

---

I do not know the sources of dom4j. I assume, that it does not depend directly 
on some specific XML parser implementation. It should only depend on the API
(JAXP, PullParser API).

The concrete parser implementation should be selected by the project
that uses dom4j, not dom4j itself.

---

The dependencies in dom4j POM should be tagged as "optional".

Example:

<dependency>
  <groupId>xpp3</groupId>
  <artifactId>xpp3</artifactId>
  <version>1.1.3.3</version>
  <optional>true</optional>
</dependency> 

---

Has anyone similar problem?
Has anyone found a better solution?

Thanks in advance

Michal Palicka
Cleverlance


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
dom4j-user mailing list
dom4j-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dom4j-user

Reply via email to