Overview

NEDXML API: Overview
NEDXML API
Overview

Overview of the library.

The NED-XML infrastructure is centered around data classes that are the in-memory representation of NED. The data structure is an object tree, where each XML element (e.g. <param name="address" datatype="string"/>) is represented by an object. The central class is ASTNode, which provides DOM-like generic methods to navigate the tree, enumerate and query attributes, etc. Each XML element has a corresponding class, subclassed from ASTNode, e.g. for the <param> element the class is called ParamElement. Specific element classes provide a stricter, more typed interface to access the data tree.

Several components build around the data classes:

  • input filters build a NEDXML object tree using data from some external data source. Currently available input filters are NED parser and XML parser.
  • output filters take a NEDXML object tree and transform it into some other format. Currently available output filters are NED generator, XML generator, and C++ code generator (for nedc).
  • validators check that a NEDXML object tree contains valid information, that is, it conforms to the DTD and other, stricter rules. Currently implemented validators consist of several stages which can check the tree up to the level required by nedc.

An exciting "output filter", network builder is implemented as an optional part of the simulation library. Network builder can set up a simulation model on the fly, provided that all simple modules are present in the executable.

Based on the infrastructure, a NED compiler can be assembled from a NED parser and a C++ code generator component. GNED can utilize the NED parser and NED generator components. Both nedc and GNED will be able to import and export XML by just adding the XML parser and XML generator components. The infrastructure makes it easier to build models dynamically. For example, when building networks from data coming from a database, one might let the database query produce XML (several databases are already capable of that), then apply an XSLT transformation to convert to NED-XML if needed. Then one might apply the network builder to set up the network directly; or use the NED generator to create NED source for debugging purposes.

The central idea is to have a common data structure for representing NED, and this data stucture can act as a hub for connecting different data formats, data sources and applications.