I noticed and solved this problem years ago. There are a bunch of ways it can be done. Your quite right that this is a special case and your quite right that it needs a special solution.

Solution 1

In aXML tags delimited by brackets of type ( ) (/) compute prior to their child tags unless their child tags are also of type ( ) (/)

(ignore) <db_select> <query>.... ... ... </db_select> (/ignore)

Where the ignore plugin takes all the data within it's scope, stores them in a memory location and inserts a special token which directs the parser to reinsert that data at that position immediately prior to exit after the processing of the rest of the document is complete.

Solution 2

Let's make the problem harder; we want to output a fragment of aXML which contains tags of type ( ) (/)

For instance:

(db_select) <query>... ... ... (/db_select)

Clearly if we use the above method, the (db_select) (/db_select) tag will be computed prior to the (ignore) tag, in accordance with the rules of precedence for the tag types. In this case we need to seperate the data off into another file and insert the token which triggers the post processing inclusion routine mentioned above.

We can do that by having a plugin called something like <post_inc> or <delay_include> or whatever, which takes a path to file which is to be included at the end without being processed. This tag loads the file, stores the data in memory and inserts the appropriate special token the same as above.

Solution 3

Let's say you don't want to use a separate file for some reason, perhaps you dislike having lots of small data files and you prefer a more monolithic approach. (*note1 see below)

You can simply convert the brackets to the html standard for special chars :

&lt;db_select&gt; &lt;query&gt; SELECT * FROM users &lt;/query&gt; ... ... &lt;/db_select&gt;

The parser will then pass straight over it because it will not consider the string to contain any valid tags.

Since you can also use tags of type ( ) (/) and [ ] [/] in aXML you have 4 extra specials in accordance with the same rules you have for html:

[ ] [/] becomes &lsb; &rsb; &lsb;/&rsb; ( ) (/) becomes &lb; &rb; &lb;/&rb;

I'm pretty sure this covers all the bases, and I haven't needed anything more esoteric than that yet in over 4 years of using aXML.




*note1 ... eventually I'm planning to get round to writing an aXML aware editor that will make traversing structures composed of many small files quick and easy. I have mentioned how that will work elsewhere.

In reply to Re^12: aXML vs TT2 by Logicus
in thread aXML vs TT2 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.