Posted by jamesjmp
on May 30, 2007 at 1:17 AM PDT
I want to validate an xml by means of a schema (xsd). To do that first of all IÂ´m using a SchemaFactory. The problem is that if I run the code in Windows all works fine, but If I run it in Linux there is an error. The code that fails is the following:
SchemaFactory factory =
IÂ´m sure that code is ok. In fact, IÂ´ve found that in several tutorials and guides such as:
In Linux it doesnÂ´t work and it has this exception:
[java] java.lang.IllegalArgumentException: http://www.w3.org/2001/XMLSchema
[java] at javax.xml.validation.SchemaFactory.newInstance(Sch emaFactory.java:186)
Both in Windows and Linux IÂ´m using this java version:
java version "1.5.0_11"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_11-b03)
Java HotSpot(TM) Client VM (build 1.5.0_11-b03, mixed mode)
My GNU/Linux platform is the following:
Red Hat Enterprise Linux ES release 4 (Nahant)
W3C_XML_SCHEMA_NS_URI constant is defined in http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/XMLConstants.html#W3C_...
On the other hand IÂ´ve found that there is a bug reported and supposed to be fixed related with this:
If it is fixed I guess that my java version is former to the fix. The java version IÂ´m using is the last downloadable and I donÂ´t want to use JDK 6.
IÂ´ve downloaded a recent JAXP release from https://jaxp.dev.java.net/servlets/ProjectDocumentList?folderID=4585&exp...
Exactly IÂ´ve downloaded JAXP_141.jar. IÂ´ve unpacked it and there are 2 jars:
jaxp-ri.jar and jaxp-api.jar. I have tried to use them as endorsed but again the same exception. Maybe I havenÂ´t endorse then properly. IÂ´ve moved that 2 jars to an endorsed dir IÂ´ve created in the /jre/lib. the dir is called "endorsed" so I think there is no need using a property or invoking with -Djava.endorsed.dirs=endorsed
and the result is the same.
Any idea? I just want to validate a xml file with a xsd with java 1.5 and run it in Linux!
thanks in advance