Traditionally that is true, but aXML is not traditional!

Consider this :

(refas tag="user")/path/to/userfile.xml(/refas) <table> <tr> <td>username : <user>username</user></td> <td>first name : <user>first_name</user></td> <td>surname : <user>sur_name</user></td> </tr> </table>

The refas (short for refer as) plugin builds a new plugin on the fly called "user", which extracts values from the XML file and substitutes them in the document wherever the tag exists.

The compiler would split the document up like this :

print axml(qq@(refas tag="user")/path/to/userfile.xml(/refas)@); print qq@ <table> <tr> <td>username : <user>username</user></td> <td>first name : <user>first_name</user></td> <td>surname : <user>sur_name</user></td> </tr> </table> @;

Bang! refas doesn't work anymore! The compiler doesn't know what a <user> tag is and ignores it alongside things like <table> and <tr>, and the <refas> tag doesn't have an output other than to modify the parser runtime variables to understand what a <user> tag is.

The code which would work under a compiler would have to look something like this :

(refas path="/path/to/userfile.xml") <table> <tr> <td>username : <d>username</d></td> <td>first name : <d>first_name</d></td> <td>surname : <d>sur_name</d></td> </tr> </table> (/refas)

But that is not necessarily the best way to lay the code out from an design perspective, especially if one of the <user> tags needed to be elsewhere in the document. Also the refas plugin would then also have to take input data to be modified and give an ouput, or you would have to scrap the refas tag and create a plugin called user. Thus the very act of compilation is placing constraints on the code which I designed the parser over successive code iterations to overcome/eliminate.


In reply to Re^3: rough start of an axml compiler by Logicus
in thread rough start of an axml compiler by Logicus

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.