Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / March 2006



Tip: Looking for answers? Try searching our database.

XML: Multiple Parent Nodes and DataSets?

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Moztof - 24 Mar 2006 15:22 GMT
I am using one DataSet for my entire project. Each Time I load a new XML file
into it I clear the DataSet. So things have been working rather nice and smooth
using one parent node. I have a question concerning multiple parent nodes and
one DataSet. Here is an example of my XML file:

<?xml version="1.0"?>
<albums>
<album  AlbumTitle="Road Trip" DateReleased="08/01/1998"
AlbumImg="RoadTrip_Large.png"/>
</albums>

<tracks>
<track TrackID="1" TrackNum="1" TrackName="Watering Hole"/>
<track TrackID="2" TrackNum="2" TrackName="Solitude"/>
</tracks>

Here is an example of my XML code:

var AlbumsXML:XML;
var AlbumsXML:XML = new XML();
_root.AlbumsXML.ignoreWhite = "true";
_root.datads_Container.disableEvents();
_root.datads_Container.removeAll();
_root.AlbumsXML.onLoad = xmlPopDsJEA;
_root.AlbumsXML.load("Albums.xml");
function xmlPopDsJEA(){
    numRow = _root.AlbumsXML.childNodes.length
    //trace (numRow);
    for(i = 0; i < numRow; i++){
           
            //trace (i);
            //trace(_root.AlbumsXML.childNodes.childNodes.length)
            if(_root.AlbumsXML.childNodes.childNodes.length > 0){
                trace(_root.AlbumsXML.childNodes.nodeName)
                cNodesNum =  _root.AlbumsXML.childNodes.childNodes.length;
                for(j=0; j < cNodesNum; j++){
                    var newRow:Object = new Object();
                    //trace( _root.AlbumsXML.childNodes.childNodes.nodeName);
                    var Map =  _root.AlbumsXML.childNodes.childNodes.attributes
                        for(var key in Map){
                            //trace("\t" + key + '=' + Map);
                        newRow=];
                        }
                _root.datads_Container.addItem(newRow);
                }
            }
           
    }
_root.datads_Container.enableEvents();
}

I have another MovieClip that attaches movies to a ScrollPane. I need to
differentiate, in another movie, what parent nodes to use. Here is the code to
attach the movie clips.

//goto first data set record
_root.datads_Container.first();
//var MoveiHeight = 0;
_root.amiValue = addMovieClips(0);

function addMovieClips(ami) {
    while (_root.datads_Container.hasNext()) {
    attachMovie("AlbumsListTarget", "AlbumsList"+ami, getNextHighestDepth(),
_root.datads_Container.currentItem);
    ami++;
    _root.datads_Container.next();
    }
   
    return ami;
   
}

stop();

Basically, I need an if statement that will look for the parent node names.
For some reason I can't get to that information.
I guess the code could look something like this:

function addMovieClips(ami) {
    while (_root.datads_Container.hasNext()) {
                      If((_root.datads_Container.THEPARENTNODENAME ==
'TRACKS'){
    attachMovie("AlbumsListTarget", "AlbumsList"+ami, getNextHighestDepth(),
_root.datads_Container.currentItem);
    ami++;
                     }
    _root.datads_Container.next();
    }

Perhaps there is a better approach to this. Any help is appreciated.
Moztof - 24 Mar 2006 19:35 GMT
I wrote out my XML file wrong. It should look like this...

<?xml version="1.0"?>
<albums>
<album AlbumTitle="Road Trip" DateReleased="08/01/1998"
AlbumImg="RoadTrip_Large.png"/>
<track TrackID="1" TrackNum="1" TrackName="Watering Hole"/>
<track TrackID="2" TrackNum="2" TrackName="Solitude"/>
</albums>
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.