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/