本文整理汇总了C#中libsbmlcs.SBMLDocument.getNamespaces方法的典型用法代码示例。如果您正苦于以下问题:C# SBMLDocument.getNamespaces方法的具体用法?C# SBMLDocument.getNamespaces怎么用?C# SBMLDocument.getNamespaces使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类libsbmlcs.SBMLDocument
的用法示例。
在下文中一共展示了SBMLDocument.getNamespaces方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: createExampleInvolvingUnits
/**
*
* Creates an SBML model represented in "7.2 Example involving units"
* in the SBML Level 2 Version 4 Specification.
*
*/
private static SBMLDocument createExampleInvolvingUnits()
{
int level = Level;
int version = Version;
//---------------------------------------------------------------------------
//
// Creates an SBMLDocument object
//
//---------------------------------------------------------------------------
SBMLDocument sbmlDoc = new SBMLDocument(level, version);
// Adds the namespace for XHTML to the SBMLDocument object. We need this
// because we will add notes to the model. (By default, the SBML document
// created by SBMLDocument only declares the SBML XML namespace.)
sbmlDoc.getNamespaces().add("http://www.w3.org/1999/xhtml", "xhtml");
//---------------------------------------------------------------------------
//
// Creates a Model object inside the SBMLDocument object.
//
//---------------------------------------------------------------------------
Model model = sbmlDoc.createModel();
model.setId("unitsExample");
//---------------------------------------------------------------------------
//
// Creates UnitDefinition objects inside the Model object.
//
//---------------------------------------------------------------------------
// Temporary pointers (reused more than once below).
UnitDefinition unitdef;
Unit unit;
//---------------------------------------------------------------------------
// (UnitDefinition1) Creates an UnitDefinition object ("substance").
//
// This has the effect of redefining the default unit of subtance for the
// whole model.
//---------------------------------------------------------------------------
unitdef = model.createUnitDefinition();
unitdef.setId("substance");
// Creates an Unit inside the UnitDefinition object
unit = unitdef.createUnit();
unit.setKind(libsbml.UNIT_KIND_MOLE);
unit.setScale(-3);
//--------------------------------------------------------------------------------
// (UnitDefinition2) Creates an UnitDefinition object ("mmls")
//--------------------------------------------------------------------------------
// Note that we can reuse the pointers 'unitdef' and 'unit' because the
// actual UnitDefinition object (along with the Unit objects within it)
// is already attached to the Model object.
unitdef = model.createUnitDefinition();
unitdef.setId("mmls");
// Creates an Unit inside the UnitDefinition object ("mmls")
unit = unitdef.createUnit();
unit.setKind(libsbml.UNIT_KIND_MOLE);
unit.setScale(-3);
// Creates an Unit inside the UnitDefinition object ("mmls")
unit = unitdef.createUnit();
unit.setKind(libsbml.UNIT_KIND_LITRE);
unit.setExponent(-1);
// Creates an Unit inside the UnitDefinition object ("mmls")
unit = unitdef.createUnit();
unit.setKind(libsbml.UNIT_KIND_SECOND);
unit.setExponent(-1);
//--------------------------------------------------------------------------------
// (UnitDefinition3) Creates an UnitDefinition object ("mml")
//--------------------------------------------------------------------------------
unitdef = model.createUnitDefinition();
unitdef.setId("mml");
// Creates an Unit inside the UnitDefinition object ("mml")
unit = unitdef.createUnit();
//.........这里部分代码省略.........
示例2: test_SBase_appendNotesWithGlobalNamespace
public void test_SBase_appendNotesWithGlobalNamespace()
{
string notes = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<sbml xmlns=\"http://www.sbml.org/sbml/level2/version4\" xmlns:html=\"http://www.w3.org/1999/xhtml\" level=\"2\" version=\"4\">\n" + " <model id=\"test\" name=\"name\">\n" + " <notes>\n" + " <html:p>DATE: 2010/12/08 13:00:00</html:p>\n" + " <html:p>VERSION: 0.99</html:p>\n" + " <html:p>TAXONOMY: 9606</html:p>\n" + " </notes>\n" + " </model>\n" + "</sbml>\n";
SBMLDocument sbmlDoc = new SBMLDocument (2, 4);
sbmlDoc.getNamespaces ()[email protected] ("http://www.w3.org/1999/xhtml", "html");
Model sbmlModel = sbmlDoc.createModel ();
sbmlModel.setId ("test");
sbmlModel.setName ("name");
setOrAppendNotes (sbmlModel, "<html:p>DATE: 2010/12/08 13:00:00</html:p>");
setOrAppendNotes (sbmlModel, "<html:p>VERSION: 0.99</html:p>");
setOrAppendNotes (sbmlModel, "<html:p>TAXONOMY: 9606</html:p>");
SBMLWriter ttt = new SBMLWriter ();
string documentString = ttt.writeToString (sbmlDoc);
assertTrue ((notes == documentString));
}