I wouldn'tuse default namespace, but once you have the namespace, you
should be able to access it.  @ns2::name

 

________________________________

From: flexcoders@yahoogroups.com [mailto:[EMAIL PROTECTED] On
Behalf Of Mandy
Sent: Monday, August 18, 2008 5:46 AM
To: flexcoders@yahoogroups.com
Subject: [flexcoders] Re: Namespace issue displaying xml in Tree

 

No, that really isn't the name. I put 'x' so no one could see the 
actual name.

I added:
public var ns2:Namespace = new Namespace
("http://service.xx.xx.xx.xx.xx.xx/ <http://service.xx.xx.xx.xx.xx.xx/>
");
default xml namespace = ns2;

but i haven't gotten that to work.

--- In flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
, "Alex Harui" <[EMAIL PROTECTED]> wrote:
>
> It is really @http://sevice.xxx....xx::name
<http://sevice.xxx....xx::name> 
> 
> 
> 
> You may have to declare a namespace and use it instead and maybe 
use a
> labelFunction
> 
> 
> 
> ________________________________
> 
> From: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>

[mailto:flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com>
] On
> Behalf Of Mandy
> Sent: Thursday, August 14, 2008 12:43 PM
> To: flexcoders@yahoogroups.com <mailto:flexcoders%40yahoogroups.com> 
> Subject: [flexcoders] Namespace issue displaying xml in Tree
> 
> 
> 
> I am trying to display xml data in a tree but can't get the xml to 
> correctly populate the Tree because of the namespace in front of 
the 
> attributes. 
> Here is the xml I am getting back:
> <ns2:getProductsResponse 
> xmlns:ns2="http://service.xxx.xx.xx.xx.xx.xx/
<http://service.xxx.xx.xx.xx.xx.xx/> 
> <http://service.xxx.xx.xx.xx.xx.xx/
<http://service.xxx.xx.xx.xx.xx.xx/> > ">
> <return ns2:size="344" ns2:name="Products" ns2:link="Products">
> <product ns2:name="WEATHER" ns2:link="WEATHER">
> <product ns2:name="ANALYSES" ns2:link="WEATHER.ANALYSES">
> <product ns2:name="CYCLONE" 
> ns2:link="WEATHER.ANALYSES.CYCLONE"/>
> </product>
> </product>
> </return>
> </ns2:getProductsResponse>
> 
> The tree is defined (I have tried both @name and @ns2:name):
> 
> <mx:Tree id="Tree" width="100%" height="100%" 
> labelField="@name" 
> change="treeChanged(event)"
> themeColor="#990000"
> folderClosedIcon="@Embed(source='images/marble.png')"
> folderOpenIcon="@Embed(source='images/marble.png')"
> defaultLeafIcon="@Embed(source='images/marble.png')" 
> dragEnabled="true"
> dragMoveEnabled="false" visible="true"/>
> 
> Here is my code to get the xml:
> 
> public function getProductsResult(resultObj:Object):void
> {
> private var ns2:Namespace = new Namespace
> ("http://service.xxx.xx.xx.xx.xx.xx/
<http://service.xxx.xx.xx.xx.xx.xx/> 
> <http://service.xxx.xx.xx.xx.xx.xx/
<http://service.xxx.xx.xx.xx.xx.xx/> > ");
> default xml namespace = ns2;
> var xml:XMLListCollection = new XMLListCollection(new XMLList
> (resultObj.result));
> var productsXML:XMLListCollection = new XMLListCollection
(xml.children
> ());
> }
> 
> productsXML contains everything under the ns2:getProductsResponse 
> element.
> 
> Any ideas would be greatly appreciated.
> Thanks,
> Amanda
>

 

Reply via email to