in reply to Re^2: aXML vs TT2
in thread aXML vs TT2
It's not the worst solution, but it's inherently fragile.
It requires that I know every element name that can be found in an XML document. Some formats are extensible (e.g. XHTML), so there is no such list for them. And even if we assume that list can be found, most people won't bother trying to create it.
It requires that I cross check that list against the list of keywords in a hash. How is that possible to do reliably if the list if as dynamic as you say.
This will lead to errors that can be very subtle. And given how templates are typically used, the errors will not be seen by the dev and they will be seen by end users.
The thing is, XML has already solved that problem. The mechanism is called "namespaces".
<root xmlns:a="http://axml.com/1.0/"> <a:inc title="User Info">header</a:inc> <table border=0 width="100%"> <tr> <th>User ID</th> <th>Name</th> <th>Email</th> </tr> <a:db_select> <a:query> SELECT * FROM user ORDER BY id </a:query> <a:mask> <tr> <td><a:d>id</a:d></td> <td>[hlink action="user_profile" user_id="<a:d>id</a:d>"]<a:d>na +me</a:d>[/hlink]</td> <td><a:d>email</a:d></td> </tr> </a:mask> </a:db_select> </table> <a:inc>footer</a:inc> </root>
PS — I personally prefer <inc name="header"/> over <inc>header</inc>.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^4: aXML vs TT2
by Logicus (Initiate) on Oct 21, 2011 at 19:30 UTC | |
by ikegami (Patriarch) on Oct 21, 2011 at 21:13 UTC | |
by Logicus (Initiate) on Oct 21, 2011 at 23:52 UTC | |
by ikegami (Patriarch) on Oct 22, 2011 at 01:08 UTC | |
by Logicus (Initiate) on Oct 22, 2011 at 03:48 UTC | |
| |
by anneli (Pilgrim) on Oct 22, 2011 at 02:43 UTC | |
by Logicus (Initiate) on Oct 22, 2011 at 03:05 UTC | |
by anneli (Pilgrim) on Oct 22, 2011 at 05:39 UTC | |
by Logicus (Initiate) on Oct 22, 2011 at 07:58 UTC | |
|