The default for HTTPService is resultFormat="object".  This causes your
xml to be converted into a nested structure of dynamic objects.  The
Flash Player has always had a problem differenticating between an
Object, and an array with a single element.

 

I advise changing to resultFormat="e4x" and working with your result as
XML, which does not have this issue, and has a lot of other advantages
as well.

 

Tracy

 

________________________________

From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf Of hworke
Sent: Wednesday, February 06, 2008 11:37 AM
To: [email protected]
Subject: [flexcoders] HTTPService BUG can't read RSS xml with single
item

 


Hi as I was using HTTPService I found that if the
xml file has only one item in it HTTPService returns
arreycollection with no elements in it. On the other
hand if you add one more item in the input xml file,
then it returns an arraycollection with 2 elements.

I guess this is a bug!!!! Here is the CODE:

/****************************
****************************/

Main Application

/****************************
****************************/

<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml
<http://www.adobe.com/2006/mxml> "
layout="absolute" initialize="portFolio.send();">
<mx:HTTPService id="portFolio" url="oneNode.xml" result="newArray =
portFolio.lastResult.RDF.item"/>
<mx:Script>
<![CDATA[
import mx.collections.ArrayCollection;

[Bindable]
public var newArray:ArrayCollection = new ArrayCollection();
]]>
</mx:Script>

<mx:DataGrid id="newDG" x="10" y="10" dataProvider="{newArray}"/>

</mx:Application>

/****************************
****************************/

RSS FILE with one Item (cannot read) 

/****************************
****************************/

<?xml version="1.0" encoding="ISO-8859-1" ?> 


<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#
<http://www.w3.org/1999/02/22-rdf-syntax-ns> "
xmlns:xlink="http://www.w3.org/1999/xlink <http://www.w3.org/1999/xlink>
"
xmlns="http://purl.org/rss/1.0/ <http://purl.org/rss/1.0/> "
xmlns:dc="http://purl.org/dc/elements/1.1/
<http://purl.org/dc/elements/1.1/> "
xmlns:wiki="http://purl.org/rss/1.0/modules/wiki/
<http://purl.org/rss/1.0/modules/wiki/> "
xmlns:html="http://www.w3.org/1999/xhtml <http://www.w3.org/1999/xhtml>
">
<channel rdf:about="http://localhost";>
<title>
localhost
</title>
<link>http://localhost</link>
<label>
localhost
</label>
<description>
RSS feed for search on 'WebHome'
</description>

<content>
localhost
</content>
<taglist>
localhost
</taglist>
<image rdf:resource="http://localhost/skins/albatross/logo.png
<http://localhost/skins/albatross/logo.png> "/>
<dc:language>en</dc:language>
<dc:rights>This wiki is licensed under a &#60;html:a
href=&#34;http://creativecommons.org/licenses/by/1.0/&#34;&#62;Creative
<http://creativecommons.org/licenses/by/1.0/&#34;&#62;Creative> 
Commons&#60;/html:a&#62; license</dc:rights>

<dc:publisher>Administrator </dc:publisher>
<dc:creator>Administrator </dc:creator>
<items>
<rdf:Seq>
<rdf:li
rdf:resource="http://localhost/bin/view/Organization/?language=en
<http://localhost/bin/view/Organization/?language=en> " />
</rdf:Seq>
</items>
</channel>
<image rdf:about="http://localhost/skins/albatross/logo.png
<http://localhost/skins/albatross/logo.png> ">
<title>XWiki Logo</title>
<link>http://localhost</link>

<url>http://localhost/skins/albatross/logo.png
<http://localhost/skins/albatross/logo.png> </url>
</image>

<item rdf:about="http://localhost/bin/view/Organization/?language=en
<http://localhost/bin/view/Organization/?language=en> ">
<title>Organization</title>
<link>http://localhost/bin/view/Organization/?language=en
<http://localhost/bin/view/Organization/?language=en> </link>
<description>Version 1.10 edited by Administrator on 2008-02-04
12:23:05.0</description>
<label>WebHome</label>
<taglist>[FullCustom, ASIC, SOC, IP, Software, PCB, Package, Systems,
Library, CAD]</taglist>
<content>$doc.getTags()</content>

<dc:date>2008-02-04T12:23:05-08:00</dc:date>
<dc:creator>Administrator </dc:creator>
<dc:contributor>
<rdf:Description link="">
<rdf:value>Administrator </rdf:value>
</rdf:Description>
</dc:contributor>
</item>

</rdf:RDF>

/****************************
****************************/

RSS FILE with two Items (reads fine) 

/****************************
****************************/

<?xml version="1.0" encoding="ISO-8859-1" ?>

<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#
<http://www.w3.org/1999/02/22-rdf-syntax-ns> "
xmlns:xlink="http://www.w3.org/1999/xlink <http://www.w3.org/1999/xlink>
"
xmlns="http://purl.org/rss/1.0/ <http://purl.org/rss/1.0/> "
xmlns:dc="http://purl.org/dc/elements/1.1/
<http://purl.org/dc/elements/1.1/> "
xmlns:wiki="http://purl.org/rss/1.0/modules/wiki/
<http://purl.org/rss/1.0/modules/wiki/> "
xmlns:html="http://www.w3.org/1999/xhtml <http://www.w3.org/1999/xhtml>
">
<channel rdf:about="http://localhost";>
<title>
localhost
</title>
<link>http://localhost</link>
<label>
localhost
</label>
<description>
RSS feed for search on 'WebHome'
</description>

<content>
localhost
</content>
<taglist>
localhost
</taglist>
<image rdf:resource="http://localhost/skins/albatross/logo.png
<http://localhost/skins/albatross/logo.png> "/>
<dc:language>en</dc:language>
<dc:rights>This wiki is licensed under a &#60;html:a
href=&#34;http://creativecommons.org/licenses/by/1.0/&#34;&#62;Creative
<http://creativecommons.org/licenses/by/1.0/&#34;&#62;Creative> 
Commons&#60;/html:a&#62; license</dc:rights>

<dc:publisher>Administrator </dc:publisher>
<dc:creator>Administrator </dc:creator>
<items>
<rdf:Seq>
<rdf:li
rdf:resource="http://localhost/bin/view/Organization/?language=en
<http://localhost/bin/view/Organization/?language=en> " />
</rdf:Seq>
</items>
</channel>
<image rdf:about="http://localhost/skins/albatross/logo.png
<http://localhost/skins/albatross/logo.png> ">
<title>XWiki Logo</title>
<link>http://localhost</link>

<url>http://localhost/skins/albatross/logo.png
<http://localhost/skins/albatross/logo.png> </url>
</image>

<item rdf:about="http://localhost/bin/view/Organization/?language=en
<http://localhost/bin/view/Organization/?language=en> ">
<title>Organization</title>
<link>http://localhost/bin/view/Organization/?language=en
<http://localhost/bin/view/Organization/?language=en> </link>
<description>Version 1.10 edited by Administrator on 2008-02-04
12:23:05.0</description>
<label>WebHome</label>
<taglist>[FullCustom, ASIC, SOC, IP, Software, PCB, Package, Systems,
Library, CAD]</taglist>
<content>$doc.getTags()</content>

<dc:date>2008-02-04T12:23:05-08:00</dc:date>
<dc:creator>Administrator </dc:creator>
<dc:contributor>
<rdf:Description link="">
<rdf:value>Administrator </rdf:value>
</rdf:Description>
</dc:contributor>
</item>

<item rdf:about="http://localhost/bin/view/Organization/?language=en
<http://localhost/bin/view/Organization/?language=en> ">
<title>Organization</title>
<link>http://localhost/bin/view/Organization/?language=en
<http://localhost/bin/view/Organization/?language=en> </link>
<description>Version 1.10 edited by Administrator on 2008-02-04
12:23:05.0</description>
<label>WebHome</label>
<taglist>[FullCustom, ASIC, SOC, IP, Software, PCB, Package, Systems,
Library, CAD]</taglist>
<content>$doc.getTags()</content>

<dc:date>2008-02-04T12:23:05-08:00</dc:date>
<dc:creator>Administrator </dc:creator>
<dc:contributor>
<rdf:Description link="">
<rdf:value>Administrator </rdf:value>
</rdf:Description>
</dc:contributor>
</item>

</rdf:RDF>

 

Reply via email to