Search the web
Sign In
New User? Sign Up
jsci
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Parsing Mathml using JSCI parser.parse()   Message List  
Reply | Forward Message #323 of 369 |
Hi:

I am using Jsci package to parse mathml (Convert mathml to JSci
objects). This works fine for the mathml document that has only one
set of <apply> tags. I have explained taking two math expressions below:

For example: x^2

Its mathml form:

"<apply>
<power/>
<ci>x</ci>
<cn type='integer'>2</cn>
</apply>
</annotation-xml>
</semantics>
</math>"

and: exp(x^2)

Its mathml form:

"<apply>
<power/>
<exponentiale/>
<apply>
<power/>
<ci>x</ci>
<cn type='integer'>2</cn>
</apply>
</apply>
</annotation-xml>
</semantics>
</math>"

The x^2 expression is parsed well and good. But when it comes to
exp(x^2) expression it parses only the inner most <apply> tagged math
form. So in second form only x^2 is parsed. The exponential
information is lost.

Could someone help me in using the right functions to parse the
complete mathml form??

I have posted the code below ( Thanks to herbert for the help!!!)


Thanks in advance
Pavan



public static void main(String[] args) throws
SAXNotRecognizedException, SAXNotSupportedException {
MathMLParser parser = new MathMLParser();

try {


parser.parse("D:\\Purdue_project\\ProjectsFrom14thJuly20061.40PM\\PharmaInformat\
ics\\test.xml");
//System.out.println("This is the parser.toString() output" +
parser.toString());
//System.out.println("This is the translate.toString() output" +
parser.translateToJSciObjects());


} catch (Exception e) {
System.out.println(e.getMessage());
}


Object parseList[] = parser.translateToJSciObjects();


Object list[] = parser.translateToJSciCode();

System.out.println("This is the length of the list "+ list.length);
System.out.println("This is the length of the Parse list "+
parseList.length);

for(int i=0;i<list.length;i++){
System.out.println("This is in list " + list[i].toString());
}



for (int i = 0; i < parseList.length; i++) {
JSci.io.MathMLExpression test = (JSci.io.MathMLExpression)
parseList[i];


System.out.println("This is test.evaluate()" +test.evaluate());
System.out.println("This is test.getOperation() "
+test.getOperation());
System.out.println("This is test.getArgument()
"+test.getArgument(1).toString());
System.out.println("This is test.getClass() "+test.getClass());
System.out.println("This is test.length() "+test.length());
System.out.println("This is test.toString() "+test.toString());
System.out.println("This is hashCode " +test.hashCode());



}
}




Fri Jan 12, 2007 5:54 pm

avspavan
Offline Offline
Send Email Send Email

Forward
Message #323 of 369 |
Expand Messages Author Sort by Date

Hi: I am using Jsci package to parse mathml (Convert mathml to JSci objects). This works fine for the mathml document that has only one set of <apply> tags. I...
avspavan
Offline Send Email
Jan 12, 2007
5:54 pm

Hi, Yes, you are using the right method. It could be a bug. I'll look into it. Regards, Mark ... ...
Mark Hale
mj_hale
Offline Send Email
Jan 13, 2007
11:27 pm

Hi Mark: Did you figure out what the problem is?? Is it a bug or am I using wrong classes & methods? Thanks Pavan ... ...
avspavan
Offline Send Email
Feb 16, 2007
7:29 pm

You know that your sample mathml is not a well-formed xml document? ... ...
Mark Hale
mj_hale
Offline Send Email
Feb 16, 2007
9:03 pm

Hi Mark: Sorry! I didn't copy the mathml into the previous mail correctly!! I was using the correct mathml expression for my code as below: <math...
avspavan
Offline Send Email
Feb 20, 2007
7:26 pm

I now have my laptop with me, and was able to fix the problem :D I have committed the changes to CVS. Sorry for the long delay. ... ...
Mark Hale
mj_hale
Offline Send Email
Apr 19, 2007
7:14 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help