in reply to Re^9: aXML vs TT2
in thread aXML vs TT2

I just copy/pasted «"» into an aXML document and ran it to see what would happen, and it there was no effect. The document rendered correctly and the browser displayed the characters, so I can't see the problem?

aXML doesn't need an escape character, it doesn't try to distinguish code from data, in aXML code and data are one and the same.

You iterate repeatedly that that is bad, and yet you do not qualify that statement, are you repeating some obsolete mantra you learned at university regarding the classical way of doing things or do you have a real specific reason for that argument in this context/paradigm?

With regard to your other point, in aXML the only difference between <foo bar="moo"></foo> and <foo><bar>moo</bar></foo> Is that bar as an attribute will be available to the plugin in the hash of attributes found in $_[0], whilst as an internal tag it will be found in the tag data string $_[1] and have to be extracted manually by the plugin itself if it uses it. That is why the former is the preferred format for plugins which require certain input values to determine their output.

Replies are listed 'Best First'.
Re^11: aXML vs TT2
by ikegami (Patriarch) on Oct 22, 2011 at 07:12 UTC
    The problem isn't with quotes. You used a poor metaphor, so I provided a better one. The problem is that aXML can't

    aXML doesn't need an escape character, it doesn't try to distinguish code from data, in aXML code and data are one and the same.

    Wrong, that's the really really really really big problem we're talking about, wrong.

    Did you forget what we were talking about?

    aXML needs to be able to distinguish a <d> it must process (code) and one that it must pass through (data).

    With regard to your other point, in aXML the only difference between <foo bar="moo"></foo> and <foo><bar>moo</bar></foo>

    In my examples, foo isn't a plugin. Please reread with that in mind.

      You still didn't answer my question... why is that so bad in this context/paradigm? I'm sorry but I'm not just going to take your word for it, especially when what your saying is flying in the face of years of experience of developing complex apps in aXML. I don't care if you taught Larry himself everything he knows about programming, you can't just tell me my experience is wrong without providing qualification to your statements. I doubt you would just accept my word on such a matter if it contradicted something you are well experienced with and know to be true.

      If <foo> is not a plugin then the parser will have nothing to do with it, hence you can structure it however you please and there will be no effect. aXML only acts upon correct well formed tags which it can recognise, everything else is expected to be codedata intended for another parser (I.E the parser in the client browser) and simply passes straight through untouched.

        You still didn't answer my question... why is that so bad in this context/paradigm

        Are you seriously asking what's wrong with a template system that cannot output "<d>" when you want it to? It's the very definition of failing to meet its requirements.

        If <foo> is not a plugin then the parser will have nothing to do with it, hence you can structure it however you please and there will be no effect.

        Are you saying one can use "<foo/>" for non-plugins? That's not too bad, then. I wonder how you did that without introducing any other bugs, though.

Re^11: aXML vs TT2
by Corion (Patriarch) on Oct 22, 2011 at 19:21 UTC

    I think ikegami wants to ask you how you would write an aXML program that outputs another aXML program, or an aXML fragment. For example, how would the aXML program look that outputs the following string:

    <db_select> <query> SELECT * FROM user ORDER BY id </query> <mask> <tr> <td><d>id</d></td> <td>[hlink action="user_profile" user_id="<d>id</d>"]<d>name</d> +[/hlink]</td> <td><d>email</d></td> </tr> </mask> </db_select>

    If there is no way to prevent your language from seeing a character sequence as executable code, that is highly inconvenient.

      I think ikegami wants to ask you how you would write an aXML program that outputs another aXML program

      That's one example, but I didn't have a specific example in mind.

      He's hardly going to be the only one who has elements named "inc", "query" or "d". I know of one that uses "query", and I know of a major bank that might use "d".

      That means I can't use aXML for 2 of the 4 XML formats I deal with.

        See my other reply.

      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.
        Solution 3 would work, but it means "Rock & Roll" needs to be written as "Rock &amp;amp; Roll", and "$a <=> $b" needs to be written as "$a &amp;lt;=&amp;gt; $b". Is that really what you expect people to do?