Thread: Xml
-
XML file contains <table> tags!!!!
Here's the XML file
Code:
<rss version="2.0" xmlns:nasdaq="http://nasdaq.com"><channel><title>NASDAQ.com Stock Tracker</title><link>http://www.nasdaq.com</link><description>Track your favorite stock and link to NASDAQ.com for the full details.</description><copyright>Copyright 2005 - 2010 NASDAQ.com. All rights reserved.</copyright><item><pubDate>7 Apr 2009 16:00:00 EDT</pubDate><title>7 Apr 2009 16:00:00 EDT - The latest stock information is now available for your stocks</title><author>feedback@nasdaq.com</author><description><![CDATA[
><table border=0 cellspacing=0 cellpadding=0 width="200">
<TR bgcolor="#DDDDDD">
<TD ALIGN="LEFT" COLSPAN=2 nowrap><a href="http://quotes.nasdaq.com/asp/SummaryQuote.asp?symbol=MSFT&selected=MSFT">MSFT</a>
</TD>
</TR>
<TR bgcolor="#EEEEEE">
<TD nowrap width="50%"> Last
</TD>
<TD nowrap align=right width="50%">18.76
</TD>
</TR>
<TR bgcolor="#DDDDDD">
<TD nowrap width="50%"> Change
</TD>
<TD nowrap align=right width="50%"><font color="black">unch</font>
</TD>
</TR>
<TR bgcolor="#EEEEEE">
<TD nowrap width="50%"> % Change
</TD>
<TD nowrap align=right width="50%"><font color="black">unch</font>
</TD>
</TR>
<TR bgcolor="#DDDDDD">
<TD nowrap width="50%"> Volume
</TD>
<TD nowrap align=right width="50%">65,793,013
</TD>
</TR>
</TABLE>
<TABLE WIDTH=180>
<TR bgcolor="#EEEEEE">
<TD nowrap> As of: 7 Apr 2009 16:00:00 EDT
</TD>
</TR>
<TR bgcolor="#DDDDDD">
<TD COLSPAN=2 nowrap> View: <a title="MSFT Stock Quote" href="http://quotes.nasdaq.com/asp/SummaryQuote.asp?symbol=MSFT&selected=MSFT">Stock Quote</a> | <a title="MSFT News" href="http://www.nasdaq.com/aspxcontent/newsheadlines.aspx?symbol=MSFT&selected=MSFT">News</a><BR>
</TD>
</TR>
<TR>
<TD COLSPAN=2 nowrap>
</TD>
</TR>
</TABLE>
]]></description><link>http://www.nasdaq.com/quote.dll?rss=StockQuotes&mode=stock&page=multi&symbol=MSFT</link><guid>http://www.nasdaq.com/quote.dll?rss=StockQuotes&mode=stock&page=multi&symbol=MSFT</guid></item></channel></rss>
Now here's the Question.... how do i get to the data between the CDATA and the Tables, TR, TD tags?
is it even possible?
AS3 Code Below:
Code:
var xmlLoader:URLLoader = new URLLoader()
xmlLoader.addEventListener(Event.COMPLETE, showXML)
xmlLoader.load(new URLRequest("http://www.nasdaq.com/aspxcontent/NasdaqRSS.aspx?data=quotes&symbol=MSFT"))
function showXML(e:Event):void {
var y:XML = new XML(e.target.data)
myTextField.text = y.?????????????????????????;
}
Any help with this would be great
c0der
Last edited by c0der; 04-08-2009 at 10:55 AM.
-
I Love India
Hi,
You can't
because the <table> tags inside the <!CDATA is not in proper case.. The whole data inside the <!CDATA can be get by
function showXML (e:Event):void {
var yXML:XML = new XML(e.target.data);
yXML.ignoreWhitespace = true
var newXMLNode:XML = new XML(yXML.channel[0].item[0].description);
trace (newXMLNode);
}
-
So, what we are saying here is that...
if the XML file contains <table> tags etc, i cannot feed the data i want into my Flash movie?
-
Senior Member
myText.text=xml.channel.item.description;
or
myText.text=xml.child(0).child(4).description;
- The right of the People to create Flash movies shall not be infringed. -
-
myText.text=xml.channel.item.description;
OK, this is the output i'm getting from this....
Code:
<table border=0 cellspacing=0 cellpadding=0 width="200">
<TR bgcolor="#DDDDDD">
<TD ALIGN="LEFT" COLSPAN=2 nowrap><a href="http://quotes.nasdaq.com/asp/SummaryQuote.asp?symbol=MSFT&selected=MSFT">MSFT</a>
</TD></TR>
<TR bgcolor="#EEEEEE">
<TD nowrap width="50%"> Last</TD>
<TD nowrap align=right width="50%">19.1</TD>
</TR>
<TR bgcolor="#DDDDDD">
<TD nowrap width="50%"> Change
</TD>
<TD nowrap align=right width="50%"><font color="green">+<img src=http://www.nasdaq.com/images/greenarrowsmall.gif >0.34</font> </TD></TR>
<TR bgcolor="#EEEEEE">
<TD nowrap width="50%"> % Change</TD>
<TD nowrap align=right width="50%"><font color="green">1.81%</font>
</TD></TR>
<TR bgcolor="#DDDDDD">
<TD nowrap width="50%"> Volume</TD>
<TD nowrap align=right width="50%">9,003,108
</TD></TR>
</TABLE>
<TABLE WIDTH=180>
<TR bgcolor="#EEEEEE">
<TD nowrap> As of: 8 Apr 2009 10:27:26 EDT
</TD></TR>
<TR bgcolor="#DDDDDD">
<TD COLSPAN=2 nowrap> View: <a title="MSFT Stock Quote" href="http://quotes.nasdaq.com/asp/SummaryQuote.asp?symbol=MSFT&selected=MSFT">Stock Quote</a> | <a title="MSFT News" href="http://www.nasdaq.com/aspxcontent/newsheadlines.aspx?symbol=MSFT&selected=MSFT">News</a><BR>
</TD></TR>
<TR>
<TD COLSPAN=2 nowrap>
</TD></TR></TABLE>
However i want only the data which is in bold
i want in my Flash movie a real-time feed from nasdaq.com showing me example....
STOCK SYMBOL: MSFT
CURRENT SHARE PRICE: 19.1
CHANGE: 1.81%
... sorry about the confusion
c0der
-
Senior Member
I don't think you are lucky there, since the only way to proceed is converting the CDATA contents to a String first and then back to XML
var newXML:String=String(xml.channel.item.description) ;
var tableXML:XML=new XML(newXML);
myText.text=newXML;
However, the parser reports that the XML is malformed and that kills it unless you want to continue working with a String. This feed is not made for Flash.
- The right of the People to create Flash movies shall not be infringed. -
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|