XSLT applet.

B

Benjamin Jones

I have been fighting a problem with writing an XSLT applet for several
days now.

The following code works in a command line application, and in the
applet viewer for provided with IBM eclipse. It fails in any browser,
and in the Java SDK's applet viewer.

The line marked below has an uncaught exception that shows the following
text:

Usually code that works in an application and fails in an applet is the
result of a classpath problem. I am using xalan and xerces in this
case, both of which are in the classpath.

Any suggestions regarding the origins of this problem are welcome.

Thank you,

Ben Jones

----------------------------------------------------------------------
java.lang.ExceptionInInitializerError

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at org.apache.xalan.serialize.SerializerFactory.getSerializer(Unknown
Source)

at
org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(Unknown
Source)

at
org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(Unknown
Source)

at org.apache.xalan.transformer.TransformerImpl.transform(Unknown Source)

at org.apache.xalan.transformer.TransformerImpl.transform(Unknown Source)

at
com.integretechpub.mathmltools.EquationTransformer.appletEquationForm(EquationTransformer.java:109)

at
com.integretechpub.mathmltools.EquationTransformer.init(EquationTransformer.java:334)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.RuntimeException: The resource [ XMLEntities.res ]
could not load: java.net.MalformedURLException: no protocol:
XMLEntities.res
XMLEntities.res java.net.MalformedURLException: no protocol:
XMLEntities.res

at org.apache.xalan.serialize.CharInfo.<init>(Unknown Source)

at org.apache.xalan.serialize.SerializerToXML.<clinit>(Unknown Source)

... 11 more

java.lang.ExceptionInInitializerError

at java.lang.Class.forName0(Native Method)

at java.lang.Class.forName(Unknown Source)

at org.apache.xalan.serialize.SerializerFactory.getSerializer(Unknown
Source)

at
org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(Unknown
Source)

at
org.apache.xalan.transformer.TransformerImpl.createResultContentHandler(Unknown
Source)

at org.apache.xalan.transformer.TransformerImpl.transform(Unknown Source)

at org.apache.xalan.transformer.TransformerImpl.transform(Unknown Source)

at
com.integretechpub.mathmltools.EquationTransformer.appletEquationForm(EquationTransformer.java:109)

at
com.integretechpub.mathmltools.EquationTransformer.init(EquationTransformer.java:334)

at sun.applet.AppletPanel.run(Unknown Source)

at java.lang.Thread.run(Unknown Source)

Caused by: java.lang.RuntimeException: The resource [ XMLEntities.res ]
could not load: java.net.MalformedURLException: no protocol:
XMLEntities.res
XMLEntities.res java.net.MalformedURLException: no protocol:
XMLEntities.res

at org.apache.xalan.serialize.CharInfo.<init>(Unknown Source)

at org.apache.xalan.serialize.SerializerToXML.<clinit>(Unknown Source)

... 11 more


----------------------------------------------------------------------



public String appletEquationForm(){
String eqnForm=new String();
eqnForm="thangs";
String xsl=this.getXSLTransform();
String xml=this.mathMLInput;
Source xmlSource=new StreamSource(new StringReader(xml));
Source xslSource=new StreamSource(new StringReader(xsl));
StringWriter eqnWriter=new StringWriter(4096);
StreamResult eqnResult=new StreamResult(eqnWriter);
Result eqnTestResult=new StreamResult(System.out);
javax.xml.transform.TransformerFactory transFact=
javax.xml.transform.TransformerFactory.newInstance();
StringWriter osw = new StringWriter();
PrintWriter pw = new PrintWriter(osw, false);
try{
javax.xml.transform.Transformer
trans=transFact.newTransformer(xslSource);
//
//-----------------------------------------------------------------------------------------------------
// THIS IS THE LINE THE BLOWS AN UNCAUGHT EXCEPTION
//-------------------------------------------------------------------------------------------------------
trans.transform(xmlSource,new StreamResult(pw));
//StringBuffer sb=eqnWriter.getBuffer();
//eqnForm=sb.toString();
}
catch(TransformerConfigurationException e){
System.out.println("Caught Exception "+e);
e.printStackTrace();
return("<math><matherr/><text>Configuration Exception</text></math>");
}
catch(TransformerException f){
System.out.println("Caught Exception "+f);
f.printStackTrace(System.out);
return("<math><matherr/><text>Configuration Exception</text></math>");
}
return(eqnForm);
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top