Hi,
I finally managed to detect the problem of the java.lang.ClassCastException:
I have a regular startElement method in my handler class:
public void startElement(String namespaceURI,
String sName, // simple name (localName)
String qName, // qualified name
Attributes attrs)
throws SAXException
{
I need to check the attributes and if necessary change an attribute.
So in this method I call a private method:
this.checkFileRelatedAttributes((org.xml.sax.helpers.AttributesImpl) attrs);
I cast the attrs to a AttributesImpl class because with this class I can
easily replace an attribute using the setAttribute method.
The moment the checkFileRelatedAttributes method is called the
java.lang.ClassCastException is thrown.
I have no idea why this happens or how to solve this.
Any help/hints are welcome to find a solution.
Please note that this does work under Xalan 22D14, but not with a later
version.
Regards,
Stefan
----- Original Message -----
From: "Stefan Geelen" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Wednesday, September 04, 2002 9:36 PM
Subject: Re: java.lang.ClassCastException:
> Hi,
>
> Sorry for the delay (see mail July 30th below) but here it is.
>
> ----------------------
>
> Hi,
>
> I changed from version Xalan 2.2 to Xalan 2.4.D1 and now tried with 2.4.0
>
> When I process a xml (no xsl) file I get following error (see below)
>
> This happens when I execute following :
>
> transformer.transform(saxsource, new
> javax.xml.transform.sax.SAXResult(handler));
>
> This error only happens when I transform a xml file, with a xml/xsl file
> there is no problem.
>
> Any idea what causes this ?
>
> Regards,
>
> Stefan
>
>
> java.lang.ClassCastException:
> org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy
> void com.xmlmill.PDXxml2pdf.startElement(java.lang.String,
> java.lang.String, java.lang.String, org.xml.sax.Attributes)
> void
>
org.apache.xalan.transformer.TransformerIdentityImpl.startElement(java.lang.
> String, java.lang.String, java.lang.String, org.xml.sax.Attributes)
> void
>
org.apache.xerces.parsers.AbstractSAXParser.startElement(org.apache.xerces.x
> ni.QName, org.apache.xerces.xni.XMLAttributes,
> org.apache.xerces.xni.Augmentations)
> void
>
org.apache.xerces.impl.XMLNamespaceBinder.handleStartElement(org.apache.xerc
> es.xni.QName, org.apache.xerces.xni.XMLAttributes,
> org.apache.xerces.xni.Augmentations, boolean)
> void
>
org.apache.xerces.impl.XMLNamespaceBinder.startElement(org.apache.xerces.xni
> .QName, org.apache.xerces.xni.XMLAttributes,
> org.apache.xerces.xni.Augmentations)
> void
>
org.apache.xerces.impl.dtd.XMLDTDValidator.startElement(org.apache.xerces.xn
> i.QName, org.apache.xerces.xni.XMLAttributes,
> org.apache.xerces.xni.Augmentations)
> boolean
> org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanStartElement()
> boolean
>
org.apache.xerces.impl.XMLDocumentScannerImpl$ContentDispatcher.scanRootElem
> entHook()
> boolean
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatc
> her.dispatch(boolean)
> boolean
>
org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(boolean)
> boolean org.apache.xerces.parsers.DTDConfiguration.parse(boolean)
> void
>
org.apache.xerces.parsers.DTDConfiguration.parse(org.apache.xerces.xni.parse
> r.XMLInputSource)
> void
>
org.apache.xerces.parsers.XMLParser.parse(org.apache.xerces.xni.parser.XMLIn
> putSource)
> void
> org.apache.xerces.parsers.AbstractSAXParser.parse(org.xml.sax.InputSource)
> void
>
org.apache.xalan.transformer.TransformerIdentityImpl.transform(javax.xml.tra
> nsform.Source, javax.xml.transform.Result)
> void com.xmlmill.PDXTransform.transform()
> void com.xmlmill.applet.XMLMill.convertXMLFile(java.io.File)
> void
>
com.xmlmill.applet.XMLMill.btnConvert_actionPerformed(java.awt.event.ActionE
> vent)
> void
> com.xmlmill.applet.XMLMill$4.actionPerformed(java.awt.event.ActionEvent)
> void
> javax.swing.AbstractButton.fireActionPerformed(java.awt.event.ActionEvent)
> void
>
javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(java.awt.even
> t.ActionEvent)
> void
>
javax.swing.DefaultButtonModel.fireActionPerformed(java.awt.event.ActionEven
> t)
> void javax.swing.DefaultButtonModel.setPressed(boolean)
> void
>
javax.swing.plaf.basic.BasicButtonListener.mouseReleased(java.awt.event.Mous
> eEvent)
> void java.awt.Component.processMouseEvent(java.awt.event.MouseEvent)
> void java.awt.Component.processEvent(java.awt.AWTEvent)
> void java.awt.Container.processEvent(java.awt.AWTEvent)
> void java.awt.Component.dispatchEventImpl(java.awt.AWTEvent)
> void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
> void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
> void
java.awt.LightweightDispatcher.retargetMouseEvent(java.awt.Component,
> int, java.awt.event.MouseEvent)
> boolean
>
java.awt.LightweightDispatcher.processMouseEvent(java.awt.event.MouseEvent)
> boolean java.awt.LightweightDispatcher.dispatchEvent(java.awt.AWTEvent)
> void java.awt.Container.dispatchEventImpl(java.awt.AWTEvent)
> void java.awt.Component.dispatchEvent(java.awt.AWTEvent)
> void java.awt.EventQueue.dispatchEvent(java.awt.AWTEvent)
> boolean
> java.awt.EventDispatchThread.pumpOneEventForHierarchy(java.awt.Component)
> void
> java.awt.EventDispatchThread.pumpEventsForHierarchy(java.awt.Conditional,
> java.awt.Component)
> void java.awt.EventDispatchThread.pumpEvents(java.awt.Conditional)
> void java.awt.EventDispatchThread.run()
>
>
>
>
>
> _________________________________________________________________
> Chat with friends online, try MSN Messenger: http://messenger.msn.com
>
>
>
>
> ----- Original Message -----
> From: "Joseph Kesselman" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Tuesday, July 30, 2002 3:33 PM
> Subject: Re: java.lang.ClassCastException:
>
>
> > We need more details -- a more detailed exception report (if you're
using
> > the Process class, try specifying the -EDUMP option; if you're running
> > this programmatically, call the exception's printStackTrace() method)
> > and/or a small sample document/stylesheet pair which demonstrates the
> > problem -- before we can tell you much about what's happening and why.
> >
> > ______________________________________
> > Joe Kesselman / IBM Research
> >
>