Where do you define "datascape.anchors"?
You use it as the context for this line, but you don't seem to have
defined it anywhere.
var thisDS = $('scape[title="'+UI.section+'"]', datascape.anchors);

Also, your jquery call is returning the jQuery version of the XML to
nowhere.

All you need to do is put the processing within the ajax call:

datascape.getAllAnchors = function(){
    $.get("projects/datascapes.xml",function(){
    datascape.anchors = $(data);
    var thisDS = $('scape[title="'+UI.section+'"]',
datascape.anchors);
        var dsAnchorVar = $('item[title="' + $proj +
'"]',thisDS).parents('col').attr('title');
        $.log("anchor "+$proj+"= "+ dsAnchorVar );

    });

}


On Jan 21, 2:41 pm, "Alexandre Plennevaux" <[EMAIL PROTECTED]>
wrote:
> Hello,
>
> i'm loading a bit of xml and i'm trying to use the loaded data, but i 'm 
> unsuccessful traversing it so far. Can you tell me what i'm doing wrong?
>
> here is the loading code:
>
> datascape.getAllAnchors = function(){
>     $.get("projects/datascapes.xml",function(data){
>         return $(data);
>     });
>
> }
>
> then further down, i need to retrieve an item's parent  col element "title" 
> attribute.
>
> jQuery(function($){
>
> ...
>
>         var thisDS = $('scape[title="'+UI.section+'"]', datascape.anchors);
>         var dsAnchorVar = $('item[title="' + $proj + 
> '"]',thisDS).parents('col').attr('title');
>         $.log("anchor "+$proj+"= "+ dsAnchorVar );
>
> });
>
> the console keeps on showing dsAnchorVar as "undefined"
>
> the xml file:
>
> <?xml version="1.0" encoding="UTF-8"?>
> <datascapes>
>         <scape title="title">
>                 <col title="E">
>                         <item title="electric_courtship_songs" />
>                 </col>
>                 <col title="L">
>                         <item title="liquidspace" />
>                         <item title="liquidspace01" />
>                         <item title="liquidspace02" />
>                         <item title="liquidspace03" />
>                 </col>
>                 <col title="S">
>                         <item title="space-navigable-music" />
>                 </col>
>         </scape>
>         <scape title="time">
>                 <col title="2004">
>                         <item title="electric_courtship_songs" />
>                 </col>
>                 <col title="2003">
>                         <item title="liquidspace" />
>                         <item title="liquidspace01" />
>                 </col>
>
>         </scape>
> </datascapes>
>
> Thanks for any help,
>
> Alexandre

Reply via email to