Menu

edami

UEPCS

edami is the package for interfacing with an EDA model. It provides:

  1. xmlreader - on disk, a design is split into many files, xmlreader.read_xml() loads the files into a single lxml.etree (lxml.de).
    • A custom element class is used to provide several conveniences (e.g. its xpath method uses a standard set of namespaces if not specified, xpfind the allows full xpath expressions, and others)
    • The eda: namespace prefix is used by convention.
  2. xmlmodel - provides the main interface, XMLModel, which can:
    • load the model (with xmlreader)
    • save_xml(), which does what it says.
    • handle metadata (additional model information can be stored as metadata in a separate XML namespace, e.g. [edator] uses metadata to store geometry information for the diagrams)
  3. xmlvalidators - provides a model validation interface XMLModelValidator, which :
    • validate() - validate any element in the design (pass /eda:system to validate the entire design.)

XMLModel example:

from edami.xmlmodel import XMLModel, get_id_xpath
xm = XMLModel(design_folder).load_xml()

# Print all domain keyletters
xm.xpath('/eda:system/eda:domain[@key_lettter]')

# Dump all ASL text
for asl in xm.xpath('//eda:design/text()'):
     print(get_id_xpath(asl.getparent(), withns=False))
     print(asl)

Related

Wiki: Home
Wiki: edator

Monday.com Logo