As usual, my hubris is punctured ... but it's nice. :)

I really liked this new code better than what I originally did. It's actually 
much easier to read and comprehend. 

-----Original Message-----
From: [email protected] 
[mailto:[email protected]] On Behalf Of Raul Miller
Sent: Thursday, May 06, 2010 11:18 PM
To: Programming forum
Subject: Re: [Jprogramming] Poor mans way of creating XML document files in J

On Wed, May 5, 2010 at 9:33 AM, Devon McCormick <[email protected]> wrote:
...
>   rawdata=: 2 3 $ 'Vilma';'Shenzen';'China';'Alex';'Makati';'Philippines'
>   dummies=. '{name}';'{city}';'{country}'
>   body=. ;(<xmlUser) rplc&.>  <"1 ,"2 dummies,."(_ 1)rawdata
>
>   xmlHdr,body,xmlTail

I would be tempted to rephrase that.

Perhaps:

xmlDoc=: '{user}';0 :0
<?xml version="1.0"?>
<data>
{user}
</data>
)

xmlUser=: '{name} {city} {country}';0 :0
 <user>
  <name>{name}</name>
  <city>{city}</city>
  <country>{country}</country>
 </user>
)

tmpl=:1 :0
  'names template'=. m
  [:;[:template&rplc&.> (cutnames_j_ names) <@,."1 boxopen
)

   xmlDoc tmpl xmlUser tmpl rawdata

-- 
Raul
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to