/XppML

XppML: Wrap X++ code in XML for ease of analytics

GNU Lesser General Public License v3.0LGPL-3.0

XppML - Immerse your X++ code in XML and make it machine understandable.

XppML is an add-on to Microsoft Dynamics AX2012 R3 which allows you to XMLize your X++ source.

Why

Making your source code understandable opens it up to:

  • machine learning

  • automated code reviews

    finding faulty code patterns beyond any standard BP checks

  • automated code manipulation / rewrite(s).

    e.g: automatically split RunBase classes into three classes adhering to MVC pattern.

We already have XREF and BP?

The standard XREF AX tool is useful to locate places where a particular object has been referenced, but it adds nothing toward making the source code machine understandable nor does it allow any particular sub-context of how the code has been used / constructed. The vast majority of BP checks do not extend beyond the particular method being checked.

How

Step 1: From X++ to XppML

Line X++ XppML
1 public void modifiedField(FieldId _fieldId) <source><preamble><kw>public</kw><kw>void</kw><def><method>modifiedField</method>(<el><decl><type domain="edt">FieldId</type><var domain="edt" type="FieldId">_fieldId</var></decl></el>)</def></preamble>
2 { {<bl>
3 super(_fieldId); <st><call><method name="modifiedField" table="Common"><kw>super</kw></method>(<el><var domain="edt" type="FieldId">_fieldId</var></el>)</call></st>;
4 } </bl>}</source>

Explanation of tags: XppML tags

Step 2: Save in the database

The resulting xml documents are saved into an xml-aware database

Step 3: Use XPath/XQuery and get deep insights into your code

Query XPath
Find if statements without {} //st[kw="if" and not(bl)]
Find methods returning void having only one parameter /source/preamble[kw[.="void"] and count(def/el)=1]
When supplied, what is the 3rd parameter in all error(...) calls? //call[method[.="error" and @domain="class" and @type="Global"]]/el[3]

More examples here