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

Yahoo! Groups Tips

Did you know...
Real people. Real stories. See how Yahoo! Groups impacts members worldwide.

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 #337 of 369 |
Re: [jsci] Re: Parsing Mathml using JSCI parser.parse()

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.

--- avspavan <pavan@...> wrote:

> 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 xmlns='http://www.w3.org/1998/Math/MathML'>
> <apply>
> <power/>
> <exponentiale/>
> <apply>
> <power/>
> <ci>x</ci>
> <cn type='integer'>2</cn>
> </apply>
> </apply>
> </math>
>
> Now this is exp(x^2) and this is not completely
> parsed by the
> parser.parse method. Only the inner most math form
> (x^2) is parsed. If
> I am wrong in parsing it, please correct me. I have
> already posted
> the code that I am using to parse the mathml. (see
> the previous mails
> below)
>
> Thanks
> Pavan
>
>
>
>
> --- In jsci@yahoogroups.com, Mark Hale <mj_hale@...>
> wrote:
> >
> >
> > You know that your sample mathml is not a
> well-formed
> > xml document?
> >
> > --- avspavan <pavan@...> wrote:
> >
> > > Hi Mark:
> > >
> > > Did you figure out what the problem is?? Is it a
> bug
> > > or am I using
> > > wrong classes & methods?
> > >
> > > Thanks
> > > Pavan
> > >
> > >
> > >
> > > --- In jsci@yahoogroups.com, Mark Hale
> <mj_hale@>
> > > wrote:
> > > >
> > > > Hi,
> > > >
> > > > Yes, you are using the right method. It could
> be a
> > > > bug. I'll look into it.
> > > >
> > > > Regards,
> > > >
> > > > Mark
> > > >
> > > >
> > > > --- avspavan <pavan@> wrote:
> > > >
> > > > > 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];
> > > > >
>
=== message truncated ===



___________________________________________________________
Yahoo! Answers - Got a question? Someone out there knows the answer. Try it
now.
http://uk.answers.yahoo.com/



Thu Apr 19, 2007 7:13 pm

mj_hale
Offline Offline
Send Email Send Email

Forward
Message #337 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