...

View Full Version : data.Xml "Drilling into"



reidcor
07-03-2012, 09:54 PM
Hi,

I have a javascript that produces a simple silverlight slide show of images on a page. The slideshow is populated by an xmlConfigProvider as follows:

<code>
new SlideShow.Control(new SlideShow.XmlConfigProvider({ url: "Configuration.xml" }))
</code>

in this configuration.Xml file, an element (<dataProvider>) points to a data.Xml file that contains the slide image urls. Problem is, I have several <album> elements in this file. I want some pages to point to one album, other another, and so on. I need to modify my script to point to individual album nodes under the main <data> element. Here's my latest failed attempt to do so:

<code>
new SlideShow.Control(new SlideShow.XmlConfigProvider({ url: "Configuration.xml";
getElementsByTagName("Album")[0].childNodes[0].nodeValue; album=(x[i]); i=0;}))
</code>

...where x[i] is the node, and i=0 points to the node, or <album> element by number 0, 1, 2, and so on.

Can anyone suggest what I'm doing wrong here?

Thx much!

Old Pedant
07-03-2012, 10:27 PM
Well, for starters, it would help if we had the foggiest idea what the argument to XmlConfigProvider is *supposed* to look like.

But what you gave surely can't be right.

You are passing an object:


{
url: "Configuration.xml";
getElementsByTagName("Album")[0].childNodes[0].nodeValue;
album=(x[i]);
i=0;
}

But that's not even close to the right syntax. Only the url: is proper notation.

You should be passing:


{
name1: value1,
name2: value2,
name3: value3,
name4: value4
}

So I would *assume* that what you want is something like:


{
url: "Configuration.xml",
UNKNOWN_NAME: getElementsByTagName("Album")[0].childNodes[0].nodeValue,
album: x[i],
i : 0
}

But I strongly suspect that even this isn't close to right.

Maybe if you could show the specifications for the call to XmlConfigProvider??

Old Pedant
07-03-2012, 10:32 PM
And by the by:

Problem is, I have several <album> elements in this file.

In which file? Configuration.xml or data.xml??

*********

I strongly suspect that you need to figure out how to do this by changing your Configuration.xml file's contents in some way.

reidcor
07-03-2012, 10:51 PM
Here is the configuration.Xml:

<code>
<configuration width="400" height="290" background="white">
...
<dataProvider type="XmlDataProvider">
<option name="url" value="Data.xml" />
</dataProvider>
</configuration>
</code>

It has other element tags that deal with size and slide transition. Now, the data.Xml file:

<code>
<data transition="WipeLeftTransition">
<album name="AlbumChd">
<slide image="Img/ChdHosp_1.jpg" />
<slide image="Img/ChdHosp2.jpg" />
<slide image="Img/ChdHosp3.jpg" />
<slide image="Img/ChdHosp4.jpg" />
...
</album>
<album name="AlbumDocs">
<slide image="Img/DocsComptr.jpg" />
<slide image="Img/DocsComptr4.jpg" />
<slide image="Img/DoctorsCmptr_1.jpg" />
<slide image="Img/DocsComptr.jpg" />
...
</album>
<album name="AlbumHospit">
<slide image="Img/Hospitality_3.jpg" />
<slide image="Img/Hospitality_4.jpg" />
...
</album>
...
</data>
</code>

If I run the SlideShow with the original script, it shows every image in the data.Xml file. What I'm trying to do is modify the script so that it only picks out the <album> nodes I want for the individual page.

To address your first comment, the script and the argument to "configuration.Xml" is in its original form at the top of my post. It works like that, but shows every image from all the albums in the data.Xml file. Again, I'm trying to parse it (data.Xml) to pick out individual <album> nodes for an individual page.

Old Pedant
07-04-2012, 02:10 AM
And, again, I suspect that without major rewrite the only way to do that will be to change your configuration.xml file in some way, to tell the SilverLight player to only get certain contents from the data.xml file. Whether that is even possible or not depends on how smart the code in SlideShow.Control() is, I would imagine. But you don't show us either the code or docs for that.

I googled for "silverlight slideshow" but there were too many to even guess which one you are using.

reidcor
07-05-2012, 05:18 PM
Thanks again for replying. The j-script is too long to post here, but I can try to attach it. At its end there is a long list of "options" and I think they are for use in the configuration.Xml file, or possibly in the argument to configuration.Xml I'm attempting to modify. I just don't yet know where or how to insert the option I need. One of these options is "currentAlbumIndex" and this is probably where I'm trying to go.

Here is the complete "configuration.Xml" in it's current form:

<code>
<?xml version="1.0" encoding="utf-8" ?>
<configuration width="400" height="290" background="white">
<modules>
<module type="SlideViewer" />
<module type="ProgressBar" />
<!--<module type="SlideDescription" />-->
<module type="NavigationTray">
<option name="slideShowNavigation.playTimerInterval" value="7000" />
<option name="thumbnailViewer.left" value="83" visible="false" />
<option name="visibility" value="Collapsed" />
</module>
<module type="SlideShowNavigation">
<option name="loopAlbum" value="True" />
<option name="visibility" value="Collapsed" />
</module>
</modules>
<transitions>
<transition type="FadeTransition" name="CrossFadeTransition" />
<transition type="WipeTransition" name="WipeRightTransition">
<option name="direction" value="Right" />
</transition>
<transition type="WipeTransition" name="WipeLeftTransition">
<option name="direction" value="Left" />
</transition>
</transitions>
<dataProvider type="XmlDataProvider">
<option name="url" value="Data2.xml" />
</dataProvider>
</configuration>
</code>

Hope this helps...if you think you might have an idea for using this option, I'd love to see a suggestion.
Thx again!



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum