Tools‎ > ‎Java API‎ > ‎Documentation‎ > ‎

Populating the DOM

"create" methods

Every element in libPharmML that can have children provides methods to create those children. The syntax follows the format createFoo(), Foo behing the name or the type of that child. This method is equivalent to creating the empty object Foo() and adding to the parent. Sometimes, the same "create" method will be available with optional parameters, in order to set quickly the value of an attribute of that child element.

IPharmMLResource resource = libPharmML.createDom(PharmMLVersion.V0_6);
PharmML dom = resource.getDom();

// Creating an empty model definition and adding to the PharmML root element
ModelDefinition modelDefinition = dom.createModelDefinition();

// Creating a new structural model with blkId=sm1
StructuralModel structuralModel = modelDefinition.createStructuralModel("sm1");

Note: as libPharmML is still in development, those methods are not available in all classes, but will be implemented continuously in the future releases.