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];
> > > >
> > > >
> > > > 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());
> > > >
> > > >
> > > >
> > > > }
> > > > }
> > > >
> > > >
> > > >
> > > >
> > > > Yahoo! Groups Links
> > > >
> > > >
> > > >
> > > >
> > > >
> > >
> > >
> > >
> > >
> > >
> >
> ___________________________________________________________
> >
> > > Copy addresses and emails from any email account
> > to Yahoo! Mail -
> > quick, easy and free.
> > http://uk.docs.yahoo.com/trueswitch2.html
> > >
> >
> >
> >
> >
> >
> > Yahoo! Groups Links
> >
> === message truncated ===
>
>
>
>
>
>
> ___________________________________________________________
> New Yahoo! Mail is the ultimate force in competitive emailing. Find
out more at the Yahoo! Mail Championships. Plus: play games and win
prizes.
> http://uk.rd.yahoo.com/evt=44106/*http://mail.yahoo.net/uk
>