I suspect its because your XML is not valid. It is
missing a <math> root element.
--- stoneofjava <stoneofjava@...> wrote:
> Hi, all
>
> I tried to run a small sample using jsci IO to read
> MathML. I compile Problem.java
> through, but when running, I got following exception
> :
>
> Exception in thread "main"
> java.lang.ClassCastException
> at
>
JSci.mathml.MathMLDocumentImpl.getDocumentElement(Unknown
> Source)
> at
> JSci.io.MathMLParser.translateToJSciObjects(Unknown
> Source)
> at Problem.<init>(Problem.java:15)
> at Problem.main(Problem.java:24)
>
> And here are the files of message.xml and
> Problem.java :
>
> <!-- message.xml -->
>
> <?xml version="1.0"?>
> <!DOCTYPE html PUBLIC
> "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN"
> "http://www.w3.org/TR/MathML2/dtd/mathml2.dtd">
>
> <apply>
> <power/>
> <apply>
> <plus/>
> <ci> x </ci>
> <ci> y </ci>
> </apply>
> <cn>2</cn>
> </apply>
>
> // Problem.java
>
> import JSci.io.*;
>
> public class Problem{
>
> public Problem(){
> MathMLParser parser = new MathMLParser();
> try {
> parser.parse("message.xml");
>
> } catch(Exception e) {
> e.printStackTrace();
> }
>
> Object parseList[] =
> parser.translateToJSciObjects();
>
> for( int i=0; i<parseList.length; i++)
> {
> System.out.println("***");
> }
> }
>
> public static void main(String[] args){
> Problem p = new Problem();
> }
> }
>
>
> Any body can give me some help?
>
>
> Thanks,
>
> Jarry
>
>
>
>
>
>
> Yahoo! Groups Links
>
>
> jsci-unsubscribe@yahoogroups.com
>
>
>
>
>
___________________________________________________________
How much free photo storage do you get? Store your holiday
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com