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

Getting Started

The API should hopefully be intuitive. It can read a PharmML document, write a DOM to a PharmML document, create a stub DOM and validate a DOM. Some usage examples are contained in the contrib directory. Below are code snippets showing the basic operations provided by the API.

To get an instance of the API

ILibPharmML libPharmML = PharmMlFactory.getInstance().createLibPharmML();

To read the DOM

InputStream in = new FileInputStream("examples/example3.xml") IPharmMLResource resource = libPharmML.createDomFromResource(in); in.close; PharmML dom = res.getDom();

To write

IPharmMLResource resource = ..... OutputStream os = new FileOutputStream(aFile); libPharmML.save(os, resource); os.close();

To create

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

To validate

IPharmMLResource resource = ..... IPharmMLValidator validator = libPharmML.getValidator(); IValidationReport rpt = validator.createValidationReport(resource);

Comments