Re: [Flashcoders] dumb xml question
The Text content is always 1 level father than you'd think, so do mynode.firstChild.nodeValue mike On Apr 10, 2006, at 9:30 AM, [EMAIL PROTECTED] wrote: Hi, How can i get the innertext of an xml node of type 1 (without doing toString and stripping the xml tags) in flash mx (not 2004)? nodeValue doesn’t work on type 1 apparently… returns null… TIA, Chris. ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] dumb xml question
Don't you hate it when people don't fully read the question? ;) Lee -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Steve Webster Sent: 10 April 2006 15:05 To: Flashcoders mailing list Subject: Re: [Flashcoders] dumb xml question Chris, > How can i get the innertext of an xml node of type 1 (without doing > toString and stripping the xml tags) in flash mx (not 2004)? > > nodeValue doesn't work on type 1 apparently... returns null... Loop through all the child nodes of your node and concatenate the value of the text nodes... var nodeValue:String = ""; for (var i:Number = 0; i < node.childNodes.length; i++) { var child:XMLNode = XMLNode(node.childNodes[i]); if (child.nodeType == 3) { nodeValue += child.nodeValue; } } trace(nodeValue); If your question is how to get the equivalent of innerHTML then change... if (child.nodeType == 3) { nodeValue += child.nodeValue; } ...to... nodeValue += child.toString(); Hope this helps! Steve -- Steve Webster Head of Development Featurecreep Ltd. http://www.featurecreep.com 14 Orchard Street, Bristol, BS1 5EH 0117 905 5047 ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
Re: [Flashcoders] dumb xml question
Chris, How can i get the innertext of an xml node of type 1 (without doing toString and stripping the xml tags) in flash mx (not 2004)? nodeValue doesn’t work on type 1 apparently… returns null… Loop through all the child nodes of your node and concatenate the value of the text nodes... var nodeValue:String = ""; for (var i:Number = 0; i < node.childNodes.length; i++) { var child:XMLNode = XMLNode(node.childNodes[i]); if (child.nodeType == 3) { nodeValue += child.nodeValue; } } trace(nodeValue); If your question is how to get the equivalent of innerHTML then change... if (child.nodeType == 3) { nodeValue += child.nodeValue; } ...to... nodeValue += child.toString(); Hope this helps! Steve -- Steve Webster Head of Development Featurecreep Ltd. http://www.featurecreep.com 14 Orchard Street, Bristol, BS1 5EH 0117 905 5047 ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] dumb xml question
D'oh!! Make that really dumb xml question :) Thanks! Chris. -Oorspronkelijk bericht- Van: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Namens Adrian Lynch Verzonden: maandag 10 april 2006 15:38 Aan: Flashcoders mailing list Onderwerp: RE: [Flashcoders] dumb xml question children[0]? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: 10 April 2006 14:31 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] dumb xml question Hi, How can i get the innertext of an xml node of type 1 (without doing toString and stripping the xml tags) in flash mx (not 2004)? nodeValue doesn’t work on type 1 apparently… returns null… TIA, Chris. ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] dumb xml question
I guess you could always do for (var i in myNode) { trace(i + " =\t\t" + myNode[i]); } That might uncover the little blighter. Lee -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of coroner Sent: 10 April 2006 14:57 To: Flashcoders mailing list Subject: Re: [Flashcoders] dumb xml question trace, trace and trace again untill you find the right node/childNode... at least that's what i did until i got along with xml... ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
Re: [Flashcoders] dumb xml question
trace, trace and trace again untill you find the right node/childNode... at least that's what i did until i got along with xml... ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] dumb xml question
Hi, I had this problem, but I got around it by embedded the content of the xml feed to a new node. This way, even if I only had one node, I actually had two. It's sloppy, but it works. Lee -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: 10 April 2006 14:31 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] dumb xml question Hi, How can i get the innertext of an xml node of type 1 (without doing toString and stripping the xml tags) in flash mx (not 2004)? nodeValue doesn't work on type 1 apparently... returns null... TIA, Chris. ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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
RE: [Flashcoders] dumb xml question
children[0]? -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of [EMAIL PROTECTED] Sent: 10 April 2006 14:31 To: flashcoders@chattyfig.figleaf.com Subject: [Flashcoders] dumb xml question Hi, How can i get the innertext of an xml node of type 1 (without doing toString and stripping the xml tags) in flash mx (not 2004)? nodeValue doesn’t work on type 1 apparently… returns null… TIA, Chris. ___ Flashcoders@chattyfig.figleaf.com 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 ___ Flashcoders@chattyfig.figleaf.com 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