Domanda

I stava cercando di analizzare il documento MathML usando JScience ma non è stato successo. In seguito è il mio pezzo di codice.

import JSci.io.*;
import JSci.mathml.*;
  .
  .
public class ParsingMathML(){
 try {
        ....
        //inputFile is an xml file containing mathml code
 InputSource file = new InputSource(new FileReader(inputFile));  
 MathMLParser parser = new MathMLParser();
 parser.parse(file);

 Object[] parseList = parser.translateToJSciObjects();
}catch (Exception e) {
 e.printStackTrace();
}
}

I ottenuto l'errore da qui, quindi non ho potuto fare altro. Segue lo StackTrace:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: JSci/maths/fields/Ring$Member
 at JSci.io.MathMLParser.translateToJSciObjects(Unknown Source)
 at JSci.io.MathMLParser.translateToJSciObjects(Unknown Source)
 at mathML.ProcessMathML.processFile(ParsingMathML.java:109)
 at mathML.ProcessMathML.actionPerformed(ParsingMathML.java:72)
 at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
 at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
 at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
 at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
 at javax.swing.AbstractButton.doClick(Unknown Source)
 at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
 at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
 at java.awt.Component.processMouseEvent(Unknown Source)
 at javax.swing.JComponent.processMouseEvent(Unknown Source)
 at java.awt.Component.processEvent(Unknown Source)
 at java.awt.Container.processEvent(Unknown Source)
 at java.awt.Component.dispatchEventImpl(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
 at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
 at java.awt.Container.dispatchEventImpl(Unknown Source)
 at java.awt.Window.dispatchEventImpl(Unknown Source)
 at java.awt.Component.dispatchEvent(Unknown Source)
 at java.awt.EventQueue.dispatchEvent(Unknown Source)
 at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
 at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
 at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: JSci.maths.fields.Ring$Member
 at java.net.URLClassLoader$1.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClassInternal(Unknown Source)
 ... 31 more

Inoltre, non uno ha qualche idea di come utilizzare MathMLApplyElementImpl, MathMLDocumentImpl o qualsiasi altre classi dalla confezione JSci.mathml?

Sarà grande se è possibile fornire qualche esempio di codice su come analizzare il documento MathML.

Qualsiasi idea sarà molto apprezzato.    Grazie

È stato utile?

Soluzione

Cocnerning vostra precisa bug, sembra che la JSci.maths.fields.Ring$Member classe non esiste, che getta un ClassNotFoundException nel metodo JSci.io.MathMLParser.translateToJSciObjects.

Consente di andare a vedere il codice sorgente. Nel MathMLParser, il più notevole di utilizzo Ring.Member è come valore di ritorno. Ma può essere trovato in numerose località. E, dal momento che è in Ring.Member JSci.maths.fields, che sembra essere nella stessa JAR di MathMLParser, immagino che il problema è molto più complicato di una semplice ClassNotFoundException.

In primo luogo, si può aprire il vaso JScience per garantire che JSci.maths.fields.Ring$Member fa esiste?

Se non è il caso, si usa più caricatori di classe nella stessa applicazione? (Cose come OSGi)

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top