logo       

Related Msgs: audio.musicbrai...    enbd.general/20...    ietf.idr/2002-0...    java.ant-contri...    gnu.make.genera...    qplus.devel/200...    video.freevo.cv...    os.netbsd.ports...    yellowdog.gener...    xfree86.cvs/200...    search.nutch.us...    freedesktop.xse...    programming.swi...    capabilities.ge...    telephony.pbx.a...    mail.sylpheed.c...    db.firebase.por...    boot-loaders.u-...    recreation.radi...    netbsd.bugs/200...    web.zope.plone....    user-groups.lin...   

Re: java.lang.ClassCastException: org.apache.xerces.dom.ElementNSImpl: msg#00055

Subject: Re: java.lang.ClassCastException: org.apache.xerces.dom.ElementNSImpl

I am not sure I understand why it should work. Like Michael said, how is Xerces supposed to know that Elements are to be of type 'SecElement'? The only thing
you specified is the document class name so unless code is added in the document class such that any new element will be a SecElementImpl,
its correct to see a ClassCastException.

The code you just gave does not work in version 1.4.4 of Xerces either unless the snippet you gave is incomplete.

Thanks

Ankit Pasricha
XML Parser Development
IBM Toronto Lab
8200 Warden Avenue, Ontario L6G 1C7
Phone: (905) 413 4941



"jxrkt@xxxxxxxxxx" <jxrkt@xxxxxxxxxx>

02/23/2005 07:47 AM

Please respond to
xerces-j-user@xxxxxxxxxxxxxx

To
"xerces-j-user" <xerces-j-user@xxxxxxxxxxxxxx>
cc
Subject
Re: java.lang.ClassCastException: org.apache.xerces.dom.ElementNSImpl





I have a better example which better show my problem :


public interface SecNode extends Node {
}

public interface SecElement extends SecNode {
}
public class SecElementImpl extends ElementImpl implements
SecElement  {
}



public interface SecElementNS extends SecElement {
}
public class SecElementNSImpl extends ElementNSImpl
implements SecElementNS {
}



public interface SecDocument extends SecNode {
}
public class SecDocumentImpl extends DocumentImpl implements
SecDocument {
}

In this class, when I try this :
SecNode root = (SecNode)this.getDocumentElement();

or

SecElement root = (SecElement)this.getDocumentElement();

I get this Exception :
java.lang.ClassCastException:
org.apache.xerces.dom.ElementNSImpl

but only with xerces version >= 2
with previouses it perfectly works.

What is the problem ?


---------- Initial Header -----------


Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo