You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Ira Waxberg <ir...@waxberg.com> on 2000/12/19 06:24:47 UTC

Can't resolve XMLReader

After I shifted my code from one platform to another, 
I began to recieve ProcessorFactoryExceptions 
complaining that "trax.processor.xslt" couldn't be 
found, so I set this 
to "org.apache.xerces.parsers.SAXParser" and the 
error dissapeared. But now I get the following error:

java.lang.ClassCastException: 
org.apache.xerces.parsers.SAXParser
        at org.apache.trax.Processor.newInstance
(Processor.java:189)

I've tried the programmtic solutions:
  
org.apache.trax.Processor.setPlatformDefaultProcessor
("org.apache.xerces.parsers.SAXParser");

as well as:

  System.setProperty
("org.xml.sax.driver", "org.apache.xerces.parsers.SAXP
arser");

and

  System.setProperty
("trax.processor.xslt", "org.apache.xerces.parsers.SAX
Parser");

...but I keep getting the ClassCastException. Any 
ideas why this is happening? I'm using xalan and 
xerces from the xalan-j_1_2_2 distribution on 
jdk1.2.2 on solaris. 

* The exception happens when: 
  org.apache.trax.Processor.newInstance("xslt");

Ira
 

---------------
ira@waxberg.com

Re: Can't resolve XMLReader

Posted by Gary L Peskin <ga...@firstech.com>.
Ira Waxberg wrote:
> 
> After I shifted my code from one platform to another,
> I began to recieve ProcessorFactoryExceptions
> complaining that "trax.processor.xslt" couldn't be
> found, so I set this
> to "org.apache.xerces.parsers.SAXParser" and the
> error dissapeared. But now I get the following error:
> 
> java.lang.ClassCastException:
> org.apache.xerces.parsers.SAXParser
>         at org.apache.trax.Processor.newInstance
> (Processor.java:189)

Ira --

The trax.processor.xslt property is the name of the class of a
transformation
Processor, not the parser.  Actually, you shouldn't need to set the
value of this system property.

If the system property is not found, Xalan looks for a "trax.properties"
file and a copy of this file is found in the Xalan jar.  I have seen
some jdk implementations that are unable to load it from the jar for
some reason.  If that is the case, you should be able to extract
trax.properties and place it on the classpath it should work.

In any event, the correct value for the property for XalanJ 2.0.D01 is
org.apache.xalan.processor.StylesheetProcessor

> ...but I keep getting the ClassCastException. Any
> ideas why this is happening?

You're not supply classes that can be cast to Processor but rather SAX
XML Parsers.  If you supply the correct class name shown above, this
problem should be fixed.

> I'm using xalan and
> xerces from the xalan-j_1_2_2 distribution on
> jdk1.2.2 on solaris.

I believe you're using XalanJ 2.0.D01.  I don't think TRaX was
implemented for XalanJ 1.2.2.

HTH,
Gary