<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Recent changes to edami</title><link>https://sourceforge.net/p/the-cedar-project/wiki/edami/</link><description>Recent changes to edami</description><atom:link href="https://sourceforge.net/p/the-cedar-project/wiki/edami/feed" rel="self"/><language>en</language><lastBuildDate>Thu, 04 Mar 2021 12:31:07 -0000</lastBuildDate><atom:link href="https://sourceforge.net/p/the-cedar-project/wiki/edami/feed" rel="self" type="application/rss+xml"/><item><title>edami modified by UEPCS</title><link>https://sourceforge.net/p/the-cedar-project/wiki/edami/</link><description>&lt;div class="markdown_content"&gt;&lt;p&gt;&lt;code&gt;edami&lt;/code&gt; is the  package for interfacing with an EDA model.  It provides:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;xmlreader - on disk, a design is split into many files, &lt;code&gt;xmlreader.read_xml()&lt;/code&gt; loads the files into a single &lt;a class="" href="https://lxml.de/api.html" rel="nofollow"&gt;lxml.etree&lt;/a&gt;.&lt;ul&gt;
&lt;li&gt;A custom &lt;a class="" href="https://lxml.de/element_classes.html" rel="nofollow"&gt;element class&lt;/a&gt; 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)&lt;/li&gt;
&lt;li&gt;The &lt;code&gt;eda:&lt;/code&gt; namespace prefix is used by convention.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;xmlmodel - provides the main interface, &lt;code&gt;XMLModel&lt;/code&gt;, which can:&lt;ul&gt;
&lt;li&gt;load the model (with xmlreader)&lt;/li&gt;
&lt;li&gt;save_xml(), which does what it says. &lt;/li&gt;
&lt;li&gt;handle metadata (additional model information can be stored as metadata in a separate XML namespace, e.g. &lt;a class="alink" href="/p/the-cedar-project/wiki/edator/"&gt;[edator]&lt;/a&gt; uses metadata to store geometry information for the diagrams)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;xmlvalidators - provides a model validation interface &lt;code&gt;XMLModelValidator&lt;/code&gt;, which :&lt;ul&gt;
&lt;li&gt;validate() -  validate any element in the design (pass /eda:system to validate the  entire design.)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;XMLModel example:&lt;/p&gt;
&lt;div class="codehilite"&gt;&lt;pre&gt;&lt;span&gt;&lt;/span&gt;&lt;span class="kn"&gt;from&lt;/span&gt; &lt;span class="nn"&gt;edami.xmlmodel&lt;/span&gt; &lt;span class="kn"&gt;import&lt;/span&gt; &lt;span class="n"&gt;XMLModel&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;get_id_xpath&lt;/span&gt;
&lt;span class="n"&gt;xm&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;XMLModel&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;design_folder&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;load_xml&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt;

&lt;span class="c1"&gt;# Print all domain keyletters&lt;/span&gt;
&lt;span class="n"&gt;xm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xpath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'/eda:system/eda:domain[@key_lettter]'&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;

&lt;span class="c1"&gt;# Dump all ASL text&lt;/span&gt;
&lt;span class="k"&gt;for&lt;/span&gt; &lt;span class="n"&gt;asl&lt;/span&gt; &lt;span class="ow"&gt;in&lt;/span&gt; &lt;span class="n"&gt;xm&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;xpath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s1"&gt;'//eda:design/text()'&lt;/span&gt;&lt;span class="p"&gt;):&lt;/span&gt;
     &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;get_id_xpath&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;asl&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="n"&gt;getparent&lt;/span&gt;&lt;span class="p"&gt;(),&lt;/span&gt; &lt;span class="n"&gt;withns&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="kc"&gt;False&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
     &lt;span class="nb"&gt;print&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;asl&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;
&lt;/pre&gt;&lt;/div&gt;

&lt;/div&gt;</description><dc:creator xmlns:dc="http://purl.org/dc/elements/1.1/">UEPCS</dc:creator><pubDate>Thu, 04 Mar 2021 12:31:07 -0000</pubDate><guid>https://sourceforge.netab0637c67fcb186c212226c5906c426c16692ea9</guid></item></channel></rss>