Hi Amanda,

I usually just strip out the namespace junk; when the result is
returned.  Something like:

public function onResult(event: * = null) : void
{
      var myXML : XML = event.result as XML;
      model.myXML = new
XML(myXML.toXMLString().replace("xmlns:ns2="http://service.xxx.xx.xx.xx.\
xx.xx/"",""))
}

You would probably want to get rid of all of the "ns2:" stuff as well;
using a RegEx replace.  Just one approach.

-TH

--- In flexcoders@yahoogroups.com, "Mandy" <[EMAIL PROTECTED]> wrote:
>
> 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/";);
> default xml namespace = ns2;
>
> but i haven't gotten that to work.
>
> --- In flexcoders@yahoogroups.com, "Alex Harui" aharui@ wrote:
> >
> > It is really @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:[EMAIL PROTECTED] On
> > Behalf Of Mandy
> > Sent: Thursday, August 14, 2008 12:43 PM
> > To: flexcoders@yahoogroups.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/> ">
> > <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/> ");
> > 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