John:

That was it! Thank you very much!

I can't wait to finish this project, and get back to AS3 and E4X!!!

-Jim 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of John Axel
Eriksson
Sent: Monday, December 11, 2006 8:24 AM
To: Flashcoders mailing list
Subject: Re: [Flashcoders] nodeValue not working?

You must do customerAbout = customer.firstChild.firstChild.nodeValue; to get
the textNode and its value. Sometimes this is confusing, but the text itself
is in fact a node too.

/John


11 dec 2006 kl. 14.16 skrev Jim Robson:

> Hello all,
>
> I can't seem to access the nodeValue property of my XMLNode objects in 
> Flash
> 8 Pro. I can print the entire node (with XML markup included), which 
> isn't very useful. But when I try to print xmlNodeInstance.nodeValue, 
> I consistently get null. My code is below - can anyone see where I'm 
> going wrong?
>
> -Jim
>
> //ActionScript:
> xml.onLoad = function(success:Boolean){ if(success){ 
> showData(this.firstChild); }else{ trace("oops!"); } }
>
> function showData(rootNode){
> if(rootNode.nodeName.toUpperCase() == "CUSTOMERS"){ sector = 
> rootNode.firstChild; while(sector != null){
> if(sector.nodeName.toUpperCase() == "SECTOR"){ sectorName = 
> sector.attributes.name; // This prints the correct value:
> trace("Sector: " + sectorName);
> customer = sector.firstChild;
> while(customer != null){
> if(customer.nodeName.toUpperCase() == "ORGANIZATION"){ // I can access 
> the XML attributes without issue customerName = 
> customer.attributes.name; // This prints the correct value:
> trace("Customer Name: " + customerName); // The problem comes in when 
> I attempt to get // the nodeValue of an XMLNode...
> customerAbout = customer.firstChild.nodeValue; // **This prints null:
> trace("About: " + customerAbout);
> // If I leave out the nodeValue, Flash reads // the entire node...
> customerAbout = customer.firstChild;
> // **This prints the entire node, including // XML markup (not very 
> helpful):
> trace("About: " + customerAbout);
> }
> customer = customer.nextSibling;
> }
> }
> sector = sector.nextSibling;
> }
> }
> }
>
> XML:
> <customers>
> <sector name="Financial Services">
> <organization name="ACME Financial Services" id="1"  
> fileName="acme.jpg">
> <about>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. </
> about>
> <case>Nulla facilisi. Donec sollicitudin, ante non dictum gravida,</
> case>
> <quote>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, 
> consectetur, adipisci velit.</quote> </organization> </sector> 
> </customers>
>
> _______________________________________________
> [email protected]
> To change your subscription options or search the archive:
> http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
>
> Brought to you by Fig Leaf Software
> Premier Authorized Adobe Consulting and Training 
> http://www.figleaf.com http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training http://www.figleaf.com
http://training.figleaf.com

_______________________________________________
[email protected]
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to