[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xml-cocoon-dev
Subject:    RE: XSP size limit??
From:       Michael French <mfrench () zycor ! lgc ! com>
Date:       2000-04-28 3:27:24
[Download RAW message or body]



> -----Original Message-----
> From: Ricardo Rocha [mailto:ricardo@apache.org]
> Sent: Thursday, April 27, 2000 3:42 PM
> To: cocoon-dev@xml.apache.org
> Subject: RE: XSP size limit??
> 
> 
> In the meantime, a suitable workaround is to replace static, 
> repetitive markup by logic as illustrated in the example below.
> 
> Instead of a long list of nested elements like:
> 
>     <selectcountry selected="US">
>       <country>
>         <value>AF</value>
>         <name>Afghanistan</name>
>       </country>
>       . . . LOTS OF COUNTRIES ...
>       <country>
>         <value>ZW</value>
>         <name>Zimbabwe</name>
>       </country>
>     </selectcountry>
> 
> one may define a static, class-level array:
> 
>     <xsp:page>
>       <xsp:logic>
>         static String[][] countries = {
>           { "AF", "Afghanistan" },
>            . . .
>           { "ZW", "Zimbawe" },
>         }
>       </xsp:logic>
>       ... STUFF ...
>     </xsp:page>
> 
> and dynamically generate the "selectcountry" element like:
> 
>     <selectcountry selected="US">
>       <xsp:logic>
>         for (int i = 0; i < countries.length; i++) {
>           <country>
>             <value><xsp:expr>countries[i][0]</xsp:expr></value>
>             <name><xsp:expr>countries[i][0]</xsp:expr></name>
>           </country>
>         }
>       </xsp:logic>
>     </selectcountry>
> 

Or use external XML file:

	http://www.altheim.com/xml/specs/iso-3166.xml

Mike

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic