RE: [Flashcoders] CDATA Html Text not working
here is the snipit of code: local.obCredits[this.firstChild.childNodes[i].firstChild.childNodes[j].nodeName] = this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes; local.obCredits --- This is passed as an object later to a Class. [this.firstChild.childNodes[i].firstChild.childNodes[j].nodeName] --- this loops the node names and places them as properties of the local.obCredits object, one of them being the content this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes;--- this is how I am trying to access the content of that node. First off, I'm guessing I should use .nodeValue? Will that give me the entire node with ![CDATA[]]? Is it even possible to read the html value for html text? Thanks so much! -Chris --- Danny Kodicek [EMAIL PROTECTED] wrote: XML: content![CDATA[Blah blah a href=somelink.comsomeLink/a b some bold text /b]]/content The problem is the XML Node is not reading as a string and the html text field reads the node as a literal string instead of html text. I mean it prints something like Blah blah a href=somelink.comsomeLink/a b some bold text /b in my text field. AS: var tt:TextField = m.createTextField(txt,m.getNextHighestDepth(),0,0,0,0); tt.autoSize = true; tt.selectable = false; tt.embedFonts = true; tt.antiAliasType = advanced; tt.html = true; tt.htmlText = local.ob.content; // myXml value How are you getting this local.ob.content? That's the key issue, really. Have you tried a trace() of this value? My guess is that you're including the [CDATA bit of the field, which means you're telling the field to render the text literally, which is exactly what it's doing. Danny ___ 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 Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.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] CDATA Html Text not working
Flash doesn't actuall support the CDATA tag. It sort of does, but all 's and 's get replaced with lt;'s and gt;'s. When you stick it in a text field, it correctly interprets the HTML entities, which leads to you getting HTML tags where they shouldn't be. --- Chris W. Paterson [EMAIL PROTECTED] wrote: here is the snipit of code: local.obCredits[this.firstChild.childNodes[i].firstChild.childNodes[j].nodeName] = this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes; local.obCredits --- This is passed as an object later to a Class. [this.firstChild.childNodes[i].firstChild.childNodes[j].nodeName] --- this loops the node names and places them as properties of the local.obCredits object, one of them being the content this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes;--- this is how I am trying to access the content of that node. First off, I'm guessing I should use .nodeValue? Will that give me the entire node with ![CDATA[]]? Is it even possible to read the html value for html text? Thanks so much! -Chris --- Danny Kodicek [EMAIL PROTECTED] wrote: XML: content![CDATA[Blah blah a href=somelink.comsomeLink/a b some bold text /b]]/content The problem is the XML Node is not reading as a string and the html text field reads the node as a literal string instead of html text. I mean it prints something like Blah blah a href=somelink.comsomeLink/a b some bold text /b in my text field. AS: var tt:TextField = m.createTextField(txt,m.getNextHighestDepth(),0,0,0,0); tt.autoSize = true; tt.selectable = false; tt.embedFonts = true; tt.antiAliasType = advanced; tt.html = true; tt.htmlText = local.ob.content; // myXml value How are you getting this local.ob.content? That's the key issue, really. Have you tried a trace() of this value? My guess is that you're including the [CDATA bit of the field, which means you're telling the field to render the text literally, which is exactly what it's doing. Danny ___ 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 Looking for a deal? Find great prices on flights and hotels with Yahoo! FareChase. http://farechase.yahoo.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 Be a better Heartthrob. Get better relationship answers from someone who knows. Yahoo! Answers - Check it out. http://answers.yahoo.com/dir/?link=listsid=396545433 ___ 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] CDATA Html Text not working
Chris W. Paterson wrote: this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes;--- this is how I am trying to access the content of that node. First off, I'm guessing I should use .nodeValue? Will that give me the entire node with ![CDATA[]]? Is it even possible to read the html value for html text? Yep, there's the problem. The content of an XML node is a node in itself -- it's just a text node. It looks like this: foomy text/foo foo -- part of node A my text -- node B /foo -- part of node A So to get the text inside that foo tag, let's say we have: var fooNode:XMLNode; var textNode:XMLNode = fooNode.firstChild; var myText:String = textNode.nodeValue; myTextField.htmlText = myText; // now it should look right As you can see, the child node of foo is an XMLNode which contains the text -- it's not the string itself. I've used CDATA in XML plenty of times, and your HTML text fields will interpret the HTML as long as you're getting the string value of the text node. As for all that confusing child.firstChild.childNodes[n].child business, may I suggest XFactorStudios' excellent XPath implementation? www.xfactorstudio.com -- and then you can specify your XML with simple syntax like this: // gets an Array of XMLNodes; specifically, all bar inside a foo, starting from rootNode var nodes:Array = XPath.selectNodes(rootNode, foo/bar); It's a less confusing than manually walking the XML tree, and allows some pretty complex searches once you really get into it. ( http://www.w3.org/TR/xpath is very dense, but section 2 may give you an example of XPath's power.) ___ 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] CDATA Html Text not working
If you're using Flash 8, XPath was already integrated into its library/API. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris W. Paterson Sent: Tuesday, July 24, 2007 1:44 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] CDATA Html Text not working Great! That works! Thanks so much!! I'll look into that XPath... Maybe not for this project since it's on a tight deadline, but for the future! Thanks! Chris --- Alan MacDougall [EMAIL PROTECTED] wrote: Chris W. Paterson wrote: this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes;--- this is how I am trying to access the content of that node. First off, I'm guessing I should use .nodeValue? Will that give me the entire node with ![CDATA[]]? Is it even possible to read the html value for html text? Yep, there's the problem. The content of an XML node is a node in itself -- it's just a text node. It looks like this: foomy text/foo foo -- part of node A my text -- node B /foo -- part of node A So to get the text inside that foo tag, let's say we have: var fooNode:XMLNode; var textNode:XMLNode = fooNode.firstChild; var myText:String = textNode.nodeValue; myTextField.htmlText = myText; // now it should look right As you can see, the child node of foo is an XMLNode which contains the text -- it's not the string itself. I've used CDATA in XML plenty of times, and your HTML text fields will interpret the HTML as long as you're getting the string value of the text node. As for all that confusing child.firstChild.childNodes[n].child business, may I suggest XFactorStudios' excellent XPath implementation? www.xfactorstudio.com -- and then you can specify your XML with simple syntax like this: // gets an Array of XMLNodes; specifically, all bar inside a foo, starting from rootNode var nodes:Array = XPath.selectNodes(rootNode, foo/bar); It's a less confusing than manually walking the XML tree, and allows some pretty complex searches once you really get into it. ( http://www.w3.org/TR/xpath is very dense, but section 2 may give you an example of XPath's power.) ___ 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 Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidsc s=bz ___ 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] CDATA Html Text not working
Correct, but for most parsing functionality, the ones included in Flash 8 should be sufficient. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Tuesday, July 24, 2007 2:00 PM To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] CDATA Html Text not working But only a partial one, right? That's what I understood - others have commented on it. I have used xfactorstudios Xpath classes instead. AS3 takes care of it though if you can go that route. Jason Merrill Bank of America GTO Learning Leadership Development eTools Multimedia Team -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Ngo Sent: Tuesday, July 24, 2007 1:55 PM To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] CDATA Html Text not working If you're using Flash 8, XPath was already integrated into its library/API. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris W. Paterson Sent: Tuesday, July 24, 2007 1:44 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] CDATA Html Text not working Great! That works! Thanks so much!! I'll look into that XPath... Maybe not for this project since it's on a tight deadline, but for the future! Thanks! Chris --- Alan MacDougall [EMAIL PROTECTED] wrote: Chris W. Paterson wrote: this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes;-- - this is how I am trying to access the content of that node. First off, I'm guessing I should use .nodeValue? Will that give me the entire node with ![CDATA[]]? Is it even possible to read the html value for html text? Yep, there's the problem. The content of an XML node is a node in itself -- it's just a text node. It looks like this: foomy text/foo foo -- part of node A my text -- node B /foo -- part of node A So to get the text inside that foo tag, let's say we have: var fooNode:XMLNode; var textNode:XMLNode = fooNode.firstChild; var myText:String = textNode.nodeValue; myTextField.htmlText = myText; // now it should look right As you can see, the child node of foo is an XMLNode which contains the text -- it's not the string itself. I've used CDATA in XML plenty of times, and your HTML text fields will interpret the HTML as long as you're getting the string value of the text node. As for all that confusing child.firstChild.childNodes[n].child business, may I suggest XFactorStudios' excellent XPath implementation? www.xfactorstudio.com -- and then you can specify your XML with simple syntax like this: // gets an Array of XMLNodes; specifically, all bar inside a foo, starting from rootNode var nodes:Array = XPath.selectNodes(rootNode, foo/bar); It's a less confusing than manually walking the XML tree, and allows some pretty complex searches once you really get into it. ( http://www.w3.org/TR/xpath is very dense, but section 2 may give you an example of XPath's power.) ___ 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 __ __ Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mailp=summer+activit ies+for+kidsc s=bz ___ 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 ___ 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
Re: [Flashcoders] CDATA Html Text not working
Great! That works! Thanks so much!! I'll look into that XPath... Maybe not for this project since it's on a tight deadline, but for the future! Thanks! Chris --- Alan MacDougall [EMAIL PROTECTED] wrote: Chris W. Paterson wrote: this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes;--- this is how I am trying to access the content of that node. First off, I'm guessing I should use .nodeValue? Will that give me the entire node with ![CDATA[]]? Is it even possible to read the html value for html text? Yep, there's the problem. The content of an XML node is a node in itself -- it's just a text node. It looks like this: foomy text/foo foo -- part of node A my text -- node B /foo -- part of node A So to get the text inside that foo tag, let's say we have: var fooNode:XMLNode; var textNode:XMLNode = fooNode.firstChild; var myText:String = textNode.nodeValue; myTextField.htmlText = myText; // now it should look right As you can see, the child node of foo is an XMLNode which contains the text -- it's not the string itself. I've used CDATA in XML plenty of times, and your HTML text fields will interpret the HTML as long as you're getting the string value of the text node. As for all that confusing child.firstChild.childNodes[n].child business, may I suggest XFactorStudios' excellent XPath implementation? www.xfactorstudio.com -- and then you can specify your XML with simple syntax like this: // gets an Array of XMLNodes; specifically, all bar inside a foo, starting from rootNode var nodes:Array = XPath.selectNodes(rootNode, foo/bar); It's a less confusing than manually walking the XML tree, and allows some pretty complex searches once you really get into it. ( http://www.w3.org/TR/xpath is very dense, but section 2 may give you an example of XPath's power.) ___ 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 Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mailp=summer+activities+for+kidscs=bz ___ 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] CDATA Html Text not working
The xpath library included with Flash 8 is really quite basic, as it is the bare minimum for generated paths for databinding purposes. It only permits abbreviated syntax (though this is fine and preferable most of the time), doesn't support any axes other than child (e.g. you can't do a//b or a/../c), and only supports position filtering in predicates. (e.g. you can do x/y[1], but you can't do x/y[last()]). XFactorStudio's XPath is complete (or at least I haven't found anything that wasn't supported). If you need XPath for an AS3 (or Flex 2/3) project, I have written a library, xpath-as3, which is also a complete implementation. http://code.google.com/p/xpath-as3 Peter On 7/24/07, David Ngo [EMAIL PROTECTED] wrote: Correct, but for most parsing functionality, the ones included in Flash 8 should be sufficient. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Tuesday, July 24, 2007 2:00 PM To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] CDATA Html Text not working But only a partial one, right? That's what I understood - others have commented on it. I have used xfactorstudios Xpath classes instead. AS3 takes care of it though if you can go that route. Jason Merrill Bank of America GTO Learning Leadership Development eTools Multimedia Team -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Ngo Sent: Tuesday, July 24, 2007 1:55 PM To: flashcoders@chattyfig.figleaf.com Subject: RE: [Flashcoders] CDATA Html Text not working If you're using Flash 8, XPath was already integrated into its library/API. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris W. Paterson Sent: Tuesday, July 24, 2007 1:44 PM To: flashcoders@chattyfig.figleaf.com Subject: Re: [Flashcoders] CDATA Html Text not working Great! That works! Thanks so much!! I'll look into that XPath... Maybe not for this project since it's on a tight deadline, but for the future! Thanks! Chris --- Alan MacDougall [EMAIL PROTECTED] wrote: Chris W. Paterson wrote: this.firstChild.childNodes[i].firstChild.childNodes[j].childNodes;-- - this is how I am trying to access the content of that node. First off, I'm guessing I should use .nodeValue? Will that give me the entire node with ![CDATA[]]? Is it even possible to read the html value for html text? Yep, there's the problem. The content of an XML node is a node in itself -- it's just a text node. It looks like this: foomy text/foo foo -- part of node A my text -- node B /foo -- part of node A So to get the text inside that foo tag, let's say we have: var fooNode:XMLNode; var textNode:XMLNode = fooNode.firstChild; var myText:String = textNode.nodeValue; myTextField.htmlText = myText; // now it should look right As you can see, the child node of foo is an XMLNode which contains the text -- it's not the string itself. I've used CDATA in XML plenty of times, and your HTML text fields will interpret the HTML as long as you're getting the string value of the text node. As for all that confusing child.firstChild.childNodes[n].child business, may I suggest XFactorStudios' excellent XPath implementation? www.xfactorstudio.com -- and then you can specify your XML with simple syntax like this: // gets an Array of XMLNodes; specifically, all bar inside a foo, starting from rootNode var nodes:Array = XPath.selectNodes(rootNode, foo/bar); It's a less confusing than manually walking the XML tree, and allows some pretty complex searches once you really get into it. ( http://www.w3.org/TR/xpath is very dense, but section 2 may give you an example of XPath's power.) ___ 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 __ __ Got a little couch potato? Check out fun summer activities for kids. http://search.yahoo.com/search?fr=oni_on_mailp=summer+activit ies+for+kidsc s=bz ___ 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