gazzer82
04-16-2006, 09:42 PM
Hi
I am pulling some xml data in using xpath and storing it in a variable, i am then using this variable to poulate a combobox, unfortunately it doesn't populate correctly. The code i am using is this
stop();
import com.xfactorstudio.xml.xpath.*;
var playlistsDoc:XML = new XML();
playlistsDoc.ignoreWhite = true;
playlistsDoc.onLoad = loadplaylist;
//navigate the XML file and build your list
function loadplaylist() {
var playlists_data = XPath.selectNodes(playlistsDoc, "/node/node/leaf/@name");
var playlists_label = XPath.selectNodes(playlistsDoc, "/node/node/leaf/@id");
//var playlists = XPath.selectNodes(playlistsDoc, "/node/node/@id");
video_dg.dataProvider = this.playlist_data;
//video_dg.dataProvider = XPath.selectNodes(playlistsDoc, "/node/node/leaf/@id");
//video_dg.label = this.playlist_label;
//video_dg.label = XPath.selectNodes(playlistsDoc, "/node/node/leaf/@label");
trace(playlists_data);
trace(playlists_label);
}
playlistsDoc.load("http://localhost:8081/requests/playlist.xml");
//playlistsDoc.load("http://localhost/tw/playlist2.xml");
as you can see i am also tracing out the variables and these seem to be fine. Sorry for the many commented out line, i have been trying several ways to get this to work.
Cheers
Gareth
I am pulling some xml data in using xpath and storing it in a variable, i am then using this variable to poulate a combobox, unfortunately it doesn't populate correctly. The code i am using is this
stop();
import com.xfactorstudio.xml.xpath.*;
var playlistsDoc:XML = new XML();
playlistsDoc.ignoreWhite = true;
playlistsDoc.onLoad = loadplaylist;
//navigate the XML file and build your list
function loadplaylist() {
var playlists_data = XPath.selectNodes(playlistsDoc, "/node/node/leaf/@name");
var playlists_label = XPath.selectNodes(playlistsDoc, "/node/node/leaf/@id");
//var playlists = XPath.selectNodes(playlistsDoc, "/node/node/@id");
video_dg.dataProvider = this.playlist_data;
//video_dg.dataProvider = XPath.selectNodes(playlistsDoc, "/node/node/leaf/@id");
//video_dg.label = this.playlist_label;
//video_dg.label = XPath.selectNodes(playlistsDoc, "/node/node/leaf/@label");
trace(playlists_data);
trace(playlists_label);
}
playlistsDoc.load("http://localhost:8081/requests/playlist.xml");
//playlistsDoc.load("http://localhost/tw/playlist2.xml");
as you can see i am also tracing out the variables and these seem to be fine. Sorry for the many commented out line, i have been trying several ways to get this to work.
Cheers
Gareth