Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts

    data.Xml "Drilling into"

    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!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,633 Times in 4,595 Posts
    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:
    Code:
    { 
        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:
    Code:
    {
        name1: value1,
        name2: value2,
        name3: value3,
        name4: value4
    }
    So I would *assume* that what you want is something like:
    Code:
    { 
        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??
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,633 Times in 4,595 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    reidcor (07-03-2012)

  • #4
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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.
    Last edited by reidcor; 07-04-2012 at 12:03 AM. Reason: adding info

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,596
    Thanks
    80
    Thanked 4,633 Times in 4,595 Posts
    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.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #6
    New to the CF scene
    Join Date
    Jun 2012
    Posts
    5
    Thanks
    1
    Thanked 0 Times in 0 Posts
    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!
    Attached Files Attached Files


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •