The Xerces implemented SchemaFactory is not used by default when using Xerces 
2.8.0 with Java 5.0
-------------------------------------------------------------------------------------------------

                 Key: XERCESJ-1175
                 URL: http://issues.apache.org/jira/browse/XERCESJ-1175
             Project: Xerces2-J
          Issue Type: Bug
          Components: JAXP (javax.xml.validation)
    Affects Versions: 2.8.0
         Environment: Java 5.0
Xerces 2.8.0
Eclipse 3.2
            Reporter: Søren Gjesse
            Priority: Minor


When version 2.8.0 of xercesImpl.jar is added to the Java 5.0 classpath the 
Xerces implementation of SchemaFactory is not used by default.

The reason for this is that the content of the file 
META-INF/services/javax.xml.validation.SchemaFactory in xercesImpl.jar is

  org.apache.xerces.jaxp.validation.XMLSchemaFactory

It should be 

  
http\://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory

(note the escape character of the : after http) as Java 5.0 expects a 
SchemaFactory for each schema language in this case 
http\://www.w3.org/2001/XMLSchema

When running the following with Java 5.0 and version 2.8.0 of xercesImpl.jar on 
the classpath

  import javax.xml.XMLConstants;
  ...

  SchemaFactory factory = 
SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
  System.out.println(factory.getClass().getName());

the output is 

  com.sun.org.apache.xerces.internal.jaxp.validation.xs.SchemaFactoryImpl

Which is the Java 5.0 (Xerces 2.6.2 derivate) build-in SchemaFactory and not 
the Xerces 2.8.0 SchemaFactory.

There are several workarrounds one is to run java with the option

  
-Djavax.xml.validation.SchemaFactory:http://www.w3.org/2001/XMLSchema=org.apache.xerces.jaxp.validation.XMLSchemaFactory

Others are to use $java.home/lib/jaxp.properties or set the system property 
using System.setProperty(...). See 
http://java.sun.com/j2se/1.5.0/docs/api/javax/xml/validation/SchemaFactory.html#newInstance(java.lang.String)
 for a description of how the SchemaFactory implementation is found.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to