Re: MathML DOM implementation: I need some advise
"Pierre-Paul Delisle" <[email protected]> Fri, 03 Oct 2003 15:38:26 +0000
| Newsgroups | gmane.comp.gnome.gdome |
|---|---|
| Message-ID | <[email protected]> |
Hi, >as I said you should be able to implement it without knowing Gdome2 >internals if we assume for instance that upcasting from a MathML element >to a DOM element is done via an explicit method call and not simply a C >cast. This is quite reasonable after all since C has no knowledge of >what upcasting really is... I will follow this. But I cannot hide the fact that the Gdome2 code will inspire me. > >For the automatic generation, most of the IDL attributes in MathML DOM >interfaces correspond to XML attributes, so all the code to get/set >their value can be generated. Also, the list of parameters, the >correspondence of IDL types with C types, the extra methods provided by >every implementation (such as the up/down casts, constructors and >similar others), can be generated with great benefit for future >maintenance. > I will have a big stylesheet at the end ... ;) >In gmetadom we're doing this for generating the bindings directly from >the XML encoding of the W3C spec for DOM. I assume the MathML spec also >has a similar XML encoding. From there, it is quite easy to write XSLT >stylesheets that generate real code. You can have a look at gmetadom >sources for examples of such stylesheets. In your case however, you >wouldn't be able to generate ALL the code: at most you'll be able to >generate prototypes and methods with an empty body to be filled by hand. >Or, you can provide the method bodies and any other missing information >in a separate set of XML files and combine them with the XML files for >MathML DOM. You can see an example of this technique in gmetadom again >(Ocaml binding), where we keep a parallel set of XML files to know which >arguments can be "nullable", that is which parameters can accept a NULL >value. This is an example of missing information that cannot be inferred >safely from the spec. > I will reuse the stuff from gmetadom-0.2.0/src/gdome_caml/xsl/xml2c.xsl and use as input the mathml-dom.xml coming with the MathML2 specification. >If you're interested in going this way feel free to ask for more >information. > You're giving me great information. Thanks a lot! Pierre-Paul _________________________________________________________________ MSN Messenger : discutez en direct avec vos amis ! http://messenger.fr.msn.ca/