With DynAPI 3.0 it's now very easy to add a
configuration file to your web apps.

By using the IOElementSoda Class you can easily
convert a JavaScript Object into and xml document as
shown below:

var ini = {
        usecart:false,
        color:'red',
        timeout:5
};

dynapi.debug.print(IOElement.ws_Var2SODA(ini));

Which should display:

<soda>
        <o0>
        <a1>
                <s2>usecart|color|timeout</s2>
                <r1/>
                <a2>
                        <b3>false</b3>
                        <r2/>
                        <s3>red</s3>
                        <r2/>
                        <i3>5</i3>
                </a2>
        </a1>
        </o0>
</soda>


You can then save the SODA Object to a file on the
server. For example config.ini

Later you could then reopen the config.ini file and
convert it back into a JavaScript Object:

var fl = new FileReader(function(){
        var str = fl.read('config.ini'); // load file from
server
        var ini = IOElement.ws_SODA2Var(str);
        // now we can use the ini object
        if(ini.color) document.bgcolor = ini.color;
});



Any comments?

--
Raymond Irving

__________________________________
Do you Yahoo!?
Yahoo! SiteBuilder - Free, easy-to-use web site design software
http://sitebuilder.yahoo.com


-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Dynapi-Dev mailing list
[EMAIL PROTECTED]
http://www.mail-archive.com/[EMAIL PROTECTED]/

Reply via email to