Michael, thanks for your fast reply.
This "feature" also exists on jdk1.5.0_08...
Installed jdk1.6.0_01 and it works now :-)
Adrian.

Michael Glavassevich wrote:
Hi Adrian,

Looks like you hit a bug in Sun's implementation [1]. The DOMImplementationRegistry included with Xerces-J 2.9.0 (in xml-apis.jar) doesn't have this problem. See this FAQ [2] for how to override the APIs in the JDK with the Apache version.

Thanks.

[1] http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=5089570
[2] http://xerces.apache.org/xerces2-j/faq-general.html#faq-4

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: [EMAIL PROTECTED]
E-mail: [EMAIL PROTECTED]

Adrian Herscu <[EMAIL PROTECTED]> wrote on 06/24/2007 06:50:29 PM:

Hi all,

I need to validate an XML document against an XSD schema.
I am trying to use the org.w3c.dom.bootstrap.DOMImplementationRegistry class this way:

         DOMImplementationLS impl;
         DOMImplementationRegistry registry;

// NOTE: this causes the newInstance method to throw a
// ClassCastException :-(
//        System.setProperty(DOMImplementationRegistry.PROPERTY,
//            "org.apache.xerces.dom.DOMImplementationSourceImpl");

         // Checkstyle: IllegalCatch off
         try {
             registry = DOMImplementationRegistry.newInstance();
         } catch (Exception e) {
             throw new InternalError("couldn't get an instance of the "
                     + "DOM implementation registry because "
                     + e.getMessage());
         }
         // Checkstyle: IllegalCatch on

         impl =
             (DOMImplementationLS) registry
                 .getDOMImplementation("LS 3.0");

// NOTE: the getDOMImplementation returns a null :-(
         assert impl != null;

         return impl;

I googled about two hours...
Is there any system config that I am missing? Is there any other way to get that object? Perhaps, binding directly to the Xerces implementation?

  How?

TIA,
Adrian.

P.S. I am compiling and running this code on jdk1.5.0_12.


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


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

Reply via email to