Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Many here are bound to be familiar with TT2, so to illustrate aXML a bit more clearly it might be helpful to make a bit of a comparison between the two.

listing of a TT2 template ------------------------- [% INCLUDE header title = 'User Info' %] [% USE DBI('dbi:mSQL:mydbname') %] <table border=0 width="100%"> <tr> <th>User ID</th> <th>Name</th> <th>Email</th> </tr> [% FOREACH user IN DBI.query('SELECT * FROM user ORDER BY id') %] <tr> <td>[% user.id %]</td> <td><a href="action.pl?action=user_profile&user_id=[% user.id %]"> +[% user.name %]</a></td> <td>[% user.email %]</td> </tr> [% END %] </table> [% INCLUDE footer %] The equivalent in aXML ---------------------- <inc title="User Info">header</inc> <table border=0 width="100%"> <tr> <th>User ID</th> <th>Name</th> <th>Email</th> </tr> <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> </table> <inc>footer</inc>

As I'm sure you can see, there are clear similiarities between the two, however this example doesn't use many of aXML's more advanced features and capabilities. As you get into greater complexity than this, the two systems begin to diverge in terms of how they work, and how they are extended. Also the functionality of aXML is not set in stone by the parser, since all the symbols are defined as plugins which can be modified or overloaded as the end programmer desires to produce any result required.

If anyone would like me to translate more examples, please post them below, the more complex the better as it will show the differences and advantage of aXML more clearly.


In reply to 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":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2021-10-21 19:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My first memorable Perl project was:







    Results (83 votes). Check out past polls.

    Notices?