* *I usually do something like this, using replacement on a template (and
ignoring the special characters issue):

xmlHdr=: 0 : 0
<?xml version="1.0"?>
<data>
)

xmlTail=: 0 : 0
</data>
)

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

   rawdata=: 2 3 $ 'Vilma';'Shenzen';'China';'Alex';'Makati';'Philippines'
   dummies=. '{name}';'{city}';'{country}'
   body=. ;(<xmlUser) rplc&.>  <"1 ,"2 dummies,."(_ 1)rawdata

   xmlHdr,body,xmlTail
<?xml version="1.0"?>
<data>
 <user>
   <name>Vilma</name>
   <city>Shenzen</city>
   <country>China</country>
 </user>
 <user>
   <name>Alex</name>
   <city>Makati</city>
   <country>Philippines</country>
 </user>
</data>


On Wed, May 5, 2010 at 5:12 AM, Alex Rufon <[email protected]>wrote:

> Thanks. I should really go back and update it. There is actually whole set
> of "reserved" characters that needs to be replaced.
>
> Would make the parseUser verb complicated though. Still, you and Bill are
> both right.
>
> -----Original Message-----
> From: [email protected] [mailto:
> [email protected]] On Behalf Of Raul Miller
> Sent: Wednesday, May 05, 2010 4:47 PM
> To: Programming forum
> Subject: Re: [Jprogramming] Poor mans way of creating XML document files in
> J
>
> Also, when you are dealing with character entities,
> the very first thing you should do is convert
> & to &amp;
>
> FYI,
>
> --
> 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
>



-- 
Devon McCormick, CFA
^me^ at acm.
org is my
preferred e-mail
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to