Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / Flash / Data Integration / October 2006



Tip: Looking for answers? Try searching our database.

Newbie XML / Flash question

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jgeorg - 06 Oct 2006 12:50 GMT
Hi all,
Please help me to the following:
I use the XML connector to read an XML file. It works fine.
My question is how can I take the attributes of a specific node?
For example, in the following simple XML how can I take the attrubutes of the
node PARIS/George directly?

Thanks in advance

<node label='PARIS'>
<node label='John' tel='12345' fax='67890'/>
<node label='George' tel='12345' fax='67890'/>
</node>
<node label='Rome'>
<node label='John' tel='12345' fax='67890'/>
<node label='George' tel='12345' fax='67890'/>
</node>
Moonster - 22 Oct 2006 20:17 GMT
If you are just reading a XML file - try use the XML class instead.

With that, browse thru your XMLNode's and get the attributes like this:

var node:XMLNode = ...
trace(node.attributes["tel"]);

or:

trace(node.attributes.tel);

- Magnus

> Hi all,
>  Please help me to the following:
[quoted text clipped - 13 lines]
>  <node label='George' tel='12345' fax='67890'/>
>  </node>
prisama - 26 Oct 2006 13:13 GMT
hi,

this is right. Cause the XML Connector is made for use in combination with
components.

But of course u can use the XMLConnector class like so:

import mx.data.components.XMLConnector;
var myXML:XMLConnector = new XMLConnector();
var xcListener:Object=new Object();

xcListener.result=function(evtObj:Object){
var theXML:XML=evtObj.target.results;   //note: "results"
var RootNode:XMLNode = theXML.firstChild;
trace(RootNode.nodeName);
}

myXML.addEventListener("result",xcListener);
myXML.URL="dasdadasd.xml";
myXML.direction = "receive";
myXML.ignoreWhite=true;
myXML.trigger();
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.