XSLT applet.

Discussion in 'XML' started by Benjamin Jones, Dec 5, 2003.

  1. 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);
    }
     
    Benjamin Jones, Dec 5, 2003
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stylus Studio
    Replies:
    0
    Views:
    770
    Stylus Studio
    Aug 3, 2004
  2. Benjamin Hillsley
    Replies:
    3
    Views:
    1,750
    Dimitre Novatchev
    Sep 25, 2003
  3. ted
    Replies:
    1
    Views:
    654
    Laurens
    Jan 26, 2004
  4. Replies:
    2
    Views:
    740
    Henry S. Thompson
    Oct 19, 2005
  5. Replies:
    4
    Views:
    715
Loading...

Share This Page