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]

Reply via email to