Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SPRY NestedXMLDataSet

Status
Not open for further replies.

maguskrool

Technical User
Dec 11, 2006
77
PT
Hi. I'm learning to use the Spry framework and I've ran into some problems while creating nested xml data sets.

Here are some samples from my code:
Code:
languages.xml:
<language_list>
   <language>english</language>
   <language>portuguese</language>
</language_list>

projects.xml:
<project_list>
   <project name="proj1">
      <english>
         <title>project one</title>
         <date>2008</date>
      </english>
      <portuguese>
         <title>projecto um</title>
         <date>2008</date>
      </portuguese>
   </project>
   <project name="proj2">
      <english>
         <title>project two</title>
         <date>2008</date>
      </english>
      <portuguese>
         <title>projecto dois</title>
         <date>2008</date>
      </portuguese>
   </project>
</project list>

I then build the datasets on my index.html:
Code:
var dsLanguages = new Spry.Data.XMLDataSet("xml/languages.xml", "language_list/language");
var dsProjects1 = new Spry.Data.XMLDataSet("xml/projects.xml", "project_list/project");
var dsProjects2 = new Spry.Data.XMLDataSet("xml/projects.xml", "project_list/project/{dsLanguages::language}");
var dsProjects3 = new Spry.Data.NestedXMLDataSet(dsProjects1, "english");
var dsProjects4 = new Spry.Data.NestedXMLDataSet(dsProjects1, "{dsLanguages::language}");

And then I create the regions that will receive the data:
Code:
<p class="text_01" spry:region="dsProjects2">{title}</p> //displays "project one";
<p class="text_01" spry:region="dsProjects3">{title}</p> //displays "project one";
<p class="text_01" spry:region="dsProjects4">{title}</p> //displays nothing;

I have all the necessary .js and spry files linked. Can anyone tell me what I'm doing wrong? Thank you in advance.

 
...I've ran into some problems ...

What are the problems?

Greg
People demand freedom of speech as a compensation for the freedom of thought which they seldom use. Kierkegaard
 
Sorry, should have been more explicit.

My goal is to use a data set like dsProjects4, one that is nested and that is linked to the "language" of the dsLanguages data set. That way, when the language changes, the data displayed by regions linked to dsProjects4 will change accordingly. It works if it's not a nested data set (dsProjects2), but I don't understand why it doesn't if it's nested.

Hope this will clarify things.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top