SPUG: Generating XML

Asim Jalis asimjalis at yahoo.com
Tue Nov 20 16:26:50 CST 2001


A fourth style is to just use string
concatenation:

my $xml = "<abc>"; 
for my $x (@list) { 
  $xml .= "<data>$x</data>"; 
} 
$xml .= "</abc>";

The advantages are: it is simple, easy to
understand, and probably faster than the other
alternatives.

Separating code from formatting using templates is
useful with HTML because the formatting changes so
much. With XML layout is usually pretty stable. If
your schema or DTD changes you will probably have
to change your code anyway.


__________________________________________________
Do You Yahoo!?
Yahoo! GeoCities - quick and easy web site hosting, just $8.95/month.
http://geocities.yahoo.com/ps/info1

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://zipcon.net/spug/





More information about the spug-list mailing list