A list for the developers of CellML tools

Text archives Help


[cellml-dev] using InputFormatToMathML


Chronological Thread 
  • From: ak.miller at auckland.ac.nz (Andrew Miller)
  • Subject: [cellml-dev] using InputFormatToMathML
  • Date: Tue, 10 Aug 2010 11:27:38 +1200

On 10/08/10 10:54, Lucian Smith wrote:
> But maybe my problem is more systemic--does the 'CreateDocument' actually
> add the model to the document in question? Or are they separate, and need
> to be conjoined somehow?

Hi Lucian,

A CellML model is a document in the DOM sense - so it doesn't make sense
to link a model to a document. You could technically create a CellML
Model wrapper around a DOM object (if you implemented
cellml_api::DOMURLLoader yourself, and made it return the applicable DOM
Documents for the model when passed the applicable URIs). However, this
is needlessly complicated if all you want to do is obtain a pair of
corresponding cellml_api::Model and dom::Document implementing objects.

If you don't already have an existing MathML DOM object (on which to
fetch the ownerDocument), the easiest way to get an empty model, with a
corresponding dom::Document is as follows (for clarity, using platform
non-specific pseudocode descriptions in terms of the conventions in the
IDL file - I assume you know how this translates to XPCOM):

Create a cellml_api::CellMLBootstrap (platform specific - I'm sure you
already know the XPCOM specific method). Call it cb.
model <- cb.createModel(widestring "1.1")
modelDE <- model.QueryInterface(interface cellml_api::CellMLDOMElement)
docEl <- modelDE.domElement
doc <- docEl.ownerDocument

You now have an empty model (model), and a document corresponding to it
(doc).

Note that cellml_api::CellMLDOMElement support is optional - our CellML
API implementation (which is, as far as I know, the only one so far)
supports it, but if another implementation is created in the future, it
doesn't have to implement that interface (this decision was made just in
case someone wants to create an implementation that isn't based on the DOM).

Best wishes,
Andrew

>
> -Lucian
> _______________________________________________
> cellml-tools-developers mailing list
> cellml-tools-developers at cellml.org
> http://www.cellml.org/mailman/listinfo/cellml-tools-developers





Archive powered by MHonArc 2.6.18.

Top of page