ANML Documentation

References

This section contains additional information on eXtensible Markup Language (XML) to help developers who may be unfamiliar with the programming language understand the basic topics discussed in this guide. For more detailed information on XML, go to the W3C web site.

Basic XML

The basic component of XML is the element. An element is a thing, action, or object (anything that could be referred to as an entity in the system you are building). In ANML, the most important element is one of the many types of automaton elements (STE, counters, booleans).

An element starts with a start tag, beginning with an angle bracket followed by the name of element:

<state-transition-element

followed by space-separated attribute-value pairs that provide more details about the XML element:

<state-transition-element id="a12"

which specifies that this example element has an ID of a12.

After the attribute-value pairs, the start tag is terminated either by an end bracket > or a slash and end bracket /> depending on whether the element has or does not have content.

The content is elements nested (children) in the element (parent) or text. ANML has only one element with text content, the <regex> element in macros. An STE has children; therefore, after the start tag , children elements can be inserted followed by the STE’s end tag (the element name preceded by </ and followed by >):

<state-transition-element id="a12"> ... children elements ... </state-transition-element>

One main thing of an element with children as a container that "holds" its children elements, although sometimes it literally is a larger thing containing smaller things and sometimes the children are more like actions or concepts related to the parent element. The former situation is the case when we have automaton elements in cells:

<macro ... >
<state-transition-element ...> ... </state-transition-element>
<state-transition-element ...> ... </state-transition-element>
</macro>

Elements can be indented to make nesting clearer:

<state-transition-element ...>
<activate-on-match element="a12"/>
<activate-on-match element="a44"/>
</state-transition-element>

The activate-on-match child element (which is an element type that does not contain content) of the STE is not a thing inside the STE but is an action associated with the parent STE.

One way in XML to express relationships between elements is through the parent-child hierarchy just presented. Sometimes, however, elements are connected in some way but do not have a parent-child hierarchical relationship. There are a number of ways to express these relationships in XML; ANML uses a very simple mechanism of linking through IDs. Everything in ANML has some type of ID and any other thing that wants to connect to it uses its ID to express the relationship.

In the previous example, a connection to two STEs is expressed (the STE having the IDs a12 and a44). Because activate-on-match is an action and not a thing, the connections are actually between the parent STE and the STEs indicated by the IDs. Activate-on-match, as an action, expresses the type of connection between the STEs.

In XML, you can specify how many of each type of element is required in various contexts. For example, an optional element could have an occurrence of 0 or 1, an element for which at least one is required would have an occurrence of 1 or more.

XML does have datatypes. In ANML, datatypes are used to create different ID types for each automaton element type. However, most values in ANML are simply strings, and the ANML schema makes use of enumerations and booleans.

ANML XML Schema

The following is an example showing the hierarchical view of ANML elements.

Table 1. ANML XML Schema
automata-network
macro
port-definition
element-reference
macro
state-transition-element, counter, inverter, and, nand, or, nor, sum-of-products,  -
product-of-sums
state-transition-element, counter, inverter, and, nand, or, nor, sum-of-products,  -
product-of-sums
state-transition-element
report-on-match
activate-on-match
counter
report-on-target
activate-on-target
inverter, and, nand, or, nor
report-on-high
activate-on-high
sum-of-products
product-term
report-on-high
activate-on-high
product-of-sums
sum-term
report-on-high
activate-on-high