Perhaps I'm missing something but it seems you've extended Node but not ElementNSImpl to implement this new interface. You'd also have to return an instance of the subclass from Document.createElementNS(). If you haven't done that then the ClassCastException should be expected since the element doesn't implement SecureDocument.
"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote on 02/21/2005 11:11:05 AM: > Hello, > > I got a strange exception. Here is my problem : > > public interface SecureDocument extends Node { > } > > public class SecDocImpl extends DocumentImpl { > > public static void main(String[] args) { > > try { > > InputStream is = new FileInputStream("pathtofile"); > DOMParser p = new DOMParser(); > > > p.setProperty("http://apache.org/xml/properties/dom/document-class-name", > "mypackage.SecDocImpl"); > > p.parse(new InputSource(is)); > SecDocImpl m= (SecDocImpl)p.getDocument() ; > is.close(); > > DocumentImpl tmp = (DocumentImpl)m ; > Element e = tmp.getDocumentElement() ; > Node r = (Node)e ; //it's just to try > here is the error------> SecureDocument root = > (SecureDocument)e ; > > } catch (Exception e) { > System.err.println("error") ; > } > } > } > } > > And the exception is : > java.lang.ClassCastException: > org.apache.xerces.dom.ElementNSImpl > > with no more explanation. > > Can anybody help me ? > > > > ************************ ADSL JUSQU'A 16 MEGA + TELEPHONE GRATUIT > ************************ > L'ultra haut débit à 30EUR/mois seulement ! Et vous téléphonez > gratuitement en France vers les postes fixes, hors numéros spéciaux. > Pour profiter de cette offre exceptionnelle, cliquez ici : http: > //register.tiscali.fr/adsl/ (voir conditions sur le site) > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > Michael Glavassevich XML Parser Development IBM Toronto Lab E-mail: [EMAIL PROTECTED] E-mail: [EMAIL PROTECTED] --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]