Hi friends,

This post seems long but it really isn't , so please bear with me :)


i store a bunch of xml files inside an object for later use, here is a
an example dump:

datascape.ds = ({

ds_projects_XML : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
\n<datascapes>\n\t<scape title=\"title\">\n\t\t<col name=\"T\"/>\n\t
\t<col name=\"P\"/>\n\t\t<col name=\"F\"/>\n\t\t<project sortby=\"title
\" dsanchor=\"T\" title=\"touch\">touch</project>\n\t\t<project sortby=
\"title\" dsanchor=\"P\" title=\"pixflow-1\">pixflow-1</project>\n\t
\t<project sortby=\"title\" dsanchor=\"P\" title=\"pixflow\">pixflow</
project>\n\t\t<project sortby=\"title\" dsanchor=\"F\" title=
\"f555\">f555</project>\n\t</scape>\n\t<scape title=\"time\">\n\t
\t<col name=\"2006\"/>\n\t\t<col name=\"2007\"/>\n\t\t<col name=
\"2008\"/>\n\t\t<project sortby=\"time\" dsanchor=\"2006\" title=
\"touch\">touch</project>\n\t\t<project sortby=\"time\" dsanchor=
\"2007\" title=\"f555\">f555</project>\n\t\t<project sortby=\"time\"
dsanchor=\"2008\" title=\"pixflow\">pixflow</project>\n\t\t<project
sortby=\"time\" dsanchor=\"2008\" title=\"pixflow-1\">pixflow-1</
project>\n\t</scape>\n</datascapes>",

ds_people_XML : "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
\n<datascapes>\n\t<scape title=\"title\">\n\t\t<col name=\"A\"/>\n\t
\t<col name=\"C\"/>\n\t\t<col name=\"E\"/>\n\t\t<col name=\"F\"/>\n\t
\t<col name=\"G\"/>\n\t\t<col name=\"J\"/>\n\t\t<col name=\"L\"/>\n\t
\t<col name=\"M\"/>\n\t\t<col name=\"N\"/>\n\t\t<item sortby=\"title\"
dsanchor=\"A\" title=\"AlexandrePlennevaux\">AlexandrePlennevaux</item>
\n\t\t<item sortby=\"title\" dsanchor=\"C\" title=\"casey-reas\">casey-
reas</item>\n\t\t<item sortby=\"title\" dsanchor=\"E\" title=\"els-
vermang\">els-vermang</item>\n\t\t<item sortby=\"title\" dsanchor=\"F
\" title=\"frederik-de-wilde\">frederik-de-wilde</item>\n\t\t<item
sortby=\"title\" dsanchor=\"G\" title=\"GeorgesBush\">GeorgesBush</
item>\n\t\t<item sortby=\"title\" dsanchor=\"J\" title=\"jerome-decock
\">jerome-decock</item>\n\t\t<item sortby=\"title\" dsanchor=\"J\"
title=\"john-horton-conway\">john-horton-conway</item>\n\t\t<item
sortby=\"title\" dsanchor=\"L\" title=\"lab-au\">lab-au</item>\n\t
\t<item sortby=\"title\" dsanchor=\"M\" title=\"manuel-abendroth
\">manuel-abendroth</item>\n\t\t<item sortby=\"title\" dsanchor=\"N\"
title=\"nicolas-schoffer\">nicolas-schoffer</item>\n\t\t<item sortby=
\"title\" dsanchor=\"N\" title=\"numeriscausa\">numeriscausa</item>\n
\t</scape>\n</datascapes>"});

I assume i can access this xml like this :
datascape.ds.ds_projects_XML  or datascape.ds[ds_projects_XML],
right?
Well, it doesn't work. When I can't manage to actually USE this xml, i
fail miserably.

Here is what i'm trying to do:

datascape.minimize = function(options, callback)
    {
$.log('The content of the datascape.ds = ' + datascape.ds.toSource());
        var scapeName = options.scape;
        var xml = datascape.ds[options.xml];
        var selected = options.selected;
        var scape = $('scape[title="' + scapeName + '"]', xml);


        $('col', scape).each(function(index)
        {
// do this and do that...
 });
        callback();
    }


Here is a sample call to the function:

datascape.minimize({
            xml: 'ds_projects_XML',
            scape: UI.sortBy,
            selected: UI.dsAnchor
        }

Reply via email to