java classcast exception

Posted by shil on Stack Overflow See other posts from Stack Overflow or by shil
Published on 2010-05-03T09:05:47Z Indexed on 2010/05/03 9:08 UTC
Read the original article Hit count: 212

Filed under:
|

hi i have problems in converting an XML document type into a Document object.. this is the piece of code

line 1 : Document doc=null; line 2 : doc = (Document) parser.parse(sourceFile);

for this line 2 it throws java classcast exception..

without the typecast it shows error as

"Type mismatch: cannot convert from org.w3c.dom.Document to javax.swing.text.Document"

how do i now typecast properly? any suggestions??

© Stack Overflow or respective owner

Related posts about java

Related posts about Xml