[Flashcoders] DECODE XML Encoded Characters?
Alright, what am I doing wrong? I have tried over and over to decode an XML string, but Flash won't decode it. The XML is returning special Characters (') encoded. I have tried to use escape, unescape, encode, decode and I can't get anything to convert the encoded text to its character representation. Here is the node: ConfigParamValueSpecial Characters - amp; quot; apos; lt; gt; /ConfigParamValue var str:String = String(XPath.selectNodes(MyXML_cs.getResults(), //ConfigParamValue/text())[0]); I've tried: trace(A: + escape(str));// Special Character - amp; quot; apos; lt; gt; trace(B: + unescape(str)); // Special Character - amp; quot; apos; lt; gt; trace(C: + decode(str));// Special%20Character%20%2D%20%26amp%3B%20%20%26quot%3B%20%20%26apos%3B%20 %20%26lt%3B%20%20%26gt%3B%20%20 trace(D: + encode(str));// Special Character - amp; quot; apos; lt; gt; I'd greatly appreciate if someone could let me know how to decode this text! Thank you! Doug Coning Senior Web Development Programmer FORUM Solutions [EMAIL PROTECTED] This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply to sender's e-mail address with notification of the error and then destroy this message in all electronic and physical forms. ___ 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] DECODE XML Encoded Characters?
If this is related at all, or helps any, this is what I use to decode entities from an XML string - someone on this list suggested using XML.parseXML() private function decodeEntities(entityString:String):String { var x:XML = new XML(n+entityString+/n); x.parseXML(); return x.firstChild.firstChild.nodeValue; }; Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Doug Coning Sent: Monday, September 25, 2006 11:16 AM To: Flashcoders mailing list Subject: [Flashcoders] DECODE XML Encoded Characters? Alright, what am I doing wrong? I have tried over and over to decode an XML string, but Flash won't decode it. The XML is returning special Characters (') encoded. I have tried to use escape, unescape, encode, decode and I can't get anything to convert the encoded text to its character representation. Here is the node: ConfigParamValueSpecial Characters - amp; quot; apos; lt; gt; /ConfigParamValue var str:String = String(XPath.selectNodes(MyXML_cs.getResults(), //ConfigParamValue/text())[0]); I've tried: trace(A: + escape(str));// Special Character - amp; quot; apos; lt; gt; trace(B: + unescape(str)); // Special Character - amp; quot; apos; lt; gt; trace(C: + decode(str));// Special%20Character%20%2D%20%26amp%3B%20%20%26quot%3B%20%20%26apos%3B %20 %20%26lt%3B%20%20%26gt%3B%20%20 trace(D: + encode(str));// Special Character - amp; quot; apos; lt; gt; I'd greatly appreciate if someone could let me know how to decode this text! Thank you! Doug Coning Senior Web Development Programmer FORUM Solutions [EMAIL PROTECTED] This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply to sender's e-mail address with notification of the error and then destroy this message in all electronic and physical forms. ___ 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] DECODE XML Encoded Characters?
Those are html encodings. If you put them into an HTML textField as is they will work fine (if that is what you are after). Escape and unescape deal with URL encoding which is a different thing. If you want the html encoding to turn into the actual characters then I don't think flash can do it without you writing your own parser. Giles -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doug Coning Sent: 25 September 2006 16:16 To: Flashcoders mailing list Subject: [Flashcoders] DECODE XML Encoded Characters? Alright, what am I doing wrong? I have tried over and over to decode an XML string, but Flash won't decode it. The XML is returning special Characters (') encoded. I have tried to use escape, unescape, encode, decode and I can't get anything to convert the encoded text to its character representation. Here is the node: ConfigParamValueSpecial Characters - amp; quot; apos; lt; gt; /ConfigParamValue var str:String = String(XPath.selectNodes(MyXML_cs.getResults(), //ConfigParamValue/text())[0]); I've tried: trace(A: + escape(str));// Special Character - amp; quot; apos; lt; gt; trace(B: + unescape(str)); // Special Character - amp; quot; apos; lt; gt; trace(C: + decode(str));// Special%20Character%20%2D%20%26amp%3B%20%20%26quot%3B%20%20%26apos%3B%20 %20%26lt%3B%20%20%26gt%3B%20%20 trace(D: + encode(str));// Special Character - amp; quot; apos; lt; gt; I'd greatly appreciate if someone could let me know how to decode this text! Thank you! Doug Coning Senior Web Development Programmer FORUM Solutions [EMAIL PROTECTED] This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply to sender's e-mail address with notification of the error and then destroy this message in all electronic and physical forms. ___ 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] DECODE XML Encoded Characters?
Thanks Jason, Yes, this does parse it correctly not so much because of the parseXML step, but because of the nodeValue. I've been using the XPath class to return my XML by using the selectNodes method. Apparently, this doesn't parse the xml in the same manner as the nodeValue function does. I wonder if there is a way to get the XPath class to return the XML in the decoded manner like the nodeValue method does? Thanks again! Doug Coning -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Monday, September 25, 2006 11:23 AM To: Flashcoders mailing list Subject: RE: [Flashcoders] DECODE XML Encoded Characters? If this is related at all, or helps any, this is what I use to decode entities from an XML string - someone on this list suggested using XML.parseXML() private function decodeEntities(entityString:String):String { var x:XML = new XML(n+entityString+/n); x.parseXML(); return x.firstChild.firstChild.nodeValue; }; Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Doug Coning Sent: Monday, September 25, 2006 11:16 AM To: Flashcoders mailing list Subject: [Flashcoders] DECODE XML Encoded Characters? Alright, what am I doing wrong? I have tried over and over to decode an XML string, but Flash won't decode it. The XML is returning special Characters (') encoded. I have tried to use escape, unescape, encode, decode and I can't get anything to convert the encoded text to its character representation. Here is the node: ConfigParamValueSpecial Characters - amp; quot; apos; lt; gt; /ConfigParamValue var str:String = String(XPath.selectNodes(MyXML_cs.getResults(), //ConfigParamValue/text())[0]); I've tried: trace(A: + escape(str));// Special Character - amp; quot; apos; lt; gt; trace(B: + unescape(str)); // Special Character - amp; quot; apos; lt; gt; trace(C: + decode(str));// Special%20Character%20%2D%20%26amp%3B%20%20%26quot%3B%20%20%26apos%3B %20 %20%26lt%3B%20%20%26gt%3B%20%20 trace(D: + encode(str));// Special Character - amp; quot; apos; lt; gt; I'd greatly appreciate if someone could let me know how to decode this text! Thank you! Doug Coning Senior Web Development Programmer FORUM Solutions [EMAIL PROTECTED] This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply to sender's e-mail address with notification of the error and then destroy this message in all electronic and physical forms. ___ 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 This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply to sender's e-mail address with notification of the error and then destroy this message in all electronic and physical forms. ___ 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] DECODE XML Encoded Characters?
That decodeEntities function is actually taken from a class I wrote to overcome some annoyances with xfactorstudios Xpath implementation. So in part of the class I just use that private function as needed in a getString function I wrote which returns a string (also works with CDATA): public function getString(path:String, CDATA:Boolean):String{ var returnValue:String; if(CDATA){ returnValue = XMLNode(XPath.selectNodes(this.XMLObj, path+/text())[0]).nodeValue; }else{ returnValue = String(XPath.selectNodes(this.XMLObj, path)[0]); } return decodeEntities(returnValue); }; I can send you the class offlist if you like. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Doug Coning Sent: Monday, September 25, 2006 12:12 PM To: Flashcoders mailing list Subject: RE: [Flashcoders] DECODE XML Encoded Characters? Thanks Jason, Yes, this does parse it correctly not so much because of the parseXML step, but because of the nodeValue. I've been using the XPath class to return my XML by using the selectNodes method. Apparently, this doesn't parse the xml in the same manner as the nodeValue function does. I wonder if there is a way to get the XPath class to return the XML in the decoded manner like the nodeValue method does? Thanks again! Doug Coning -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Monday, September 25, 2006 11:23 AM To: Flashcoders mailing list Subject: RE: [Flashcoders] DECODE XML Encoded Characters? If this is related at all, or helps any, this is what I use to decode entities from an XML string - someone on this list suggested using XML.parseXML() private function decodeEntities(entityString:String):String { var x:XML = new XML(n+entityString+/n); x.parseXML(); return x.firstChild.firstChild.nodeValue; }; Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Doug Coning Sent: Monday, September 25, 2006 11:16 AM To: Flashcoders mailing list Subject: [Flashcoders] DECODE XML Encoded Characters? Alright, what am I doing wrong? I have tried over and over to decode an XML string, but Flash won't decode it. The XML is returning special Characters (') encoded. I have tried to use escape, unescape, encode, decode and I can't get anything to convert the encoded text to its character representation. Here is the node: ConfigParamValueSpecial Characters - amp; quot; apos; lt; gt; /ConfigParamValue var str:String = String(XPath.selectNodes(MyXML_cs.getResults(), //ConfigParamValue/text())[0]); I've tried: trace(A: + escape(str));// Special Character - amp; quot; apos; lt; gt; trace(B: + unescape(str)); // Special Character - amp; quot; apos; lt; gt; trace(C: + decode(str));// Special%20Character%20%2D%20%26amp%3B%20%20%26quot%3B%20%20%26apos% 3B %20 %20%26lt%3B%20%20%26gt%3B%20%20 trace(D: + encode(str));// Special Character - amp; quot; apos; lt; gt; I'd greatly appreciate if someone could let me know how to decode this text! Thank you! Doug Coning Senior Web Development Programmer FORUM Solutions [EMAIL PROTECTED] This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply to sender's e-mail address with notification of the error and then destroy this message in all electronic and physical forms. ___ 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 This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply to sender's e-mail address with notification of the error and then destroy this message in all electronic and physical forms. ___ Flashcoders@chattyfig.figleaf.com To change your subscription options or search the archive: http://chattyfig.figleaf.com/mailman/listinfo/flashcoders Brought to you
Re: [Flashcoders] DECODE XML Encoded Characters?
Just I would mention this too: import mx.utils.XMLString; var myXMLString = XMLString.escape(some string that is misbehaving breaking my xml); trace(myXMLString); //some lt;stringgt; that is misbehaving amp; breaking my xml trace(XMLString.unescape(myXMLString)); //some string that is misbehaving breaking my xml Terry May Flash Engineer __ ePrize One ePrize Drive Pleasant Ridge, MI 48069 Ph.: 248.543.6595 Fax: 248.543.3777 [EMAIL PROTECTED] The Interactive Promotion Agency www.eprize.com On 9/25/06, Merrill, Jason [EMAIL PROTECTED] wrote: That decodeEntities function is actually taken from a class I wrote to overcome some annoyances with xfactorstudios Xpath implementation. So in part of the class I just use that private function as needed in a getString function I wrote which returns a string (also works with CDATA): public function getString(path:String, CDATA:Boolean):String{ var returnValue:String; if(CDATA){ returnValue = XMLNode(XPath.selectNodes(this.XMLObj, path+/text())[0]).nodeValue; }else{ returnValue = String(XPath.selectNodes(this.XMLObj, path)[0]); } return decodeEntities(returnValue); }; I can send you the class offlist if you like. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Doug Coning Sent: Monday, September 25, 2006 12:12 PM To: Flashcoders mailing list Subject: RE: [Flashcoders] DECODE XML Encoded Characters? Thanks Jason, Yes, this does parse it correctly not so much because of the parseXML step, but because of the nodeValue. I've been using the XPath class to return my XML by using the selectNodes method. Apparently, this doesn't parse the xml in the same manner as the nodeValue function does. I wonder if there is a way to get the XPath class to return the XML in the decoded manner like the nodeValue method does? Thanks again! Doug Coning -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Monday, September 25, 2006 11:23 AM To: Flashcoders mailing list Subject: RE: [Flashcoders] DECODE XML Encoded Characters? If this is related at all, or helps any, this is what I use to decode entities from an XML string - someone on this list suggested using XML.parseXML() private function decodeEntities(entityString:String):String { var x:XML = new XML(n+entityString+/n); x.parseXML(); return x.firstChild.firstChild.nodeValue; }; Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Doug Coning Sent: Monday, September 25, 2006 11:16 AM To: Flashcoders mailing list Subject: [Flashcoders] DECODE XML Encoded Characters? Alright, what am I doing wrong? I have tried over and over to decode an XML string, but Flash won't decode it. The XML is returning special Characters (') encoded. I have tried to use escape, unescape, encode, decode and I can't get anything to convert the encoded text to its character representation. Here is the node: ConfigParamValueSpecial Characters - amp; quot; apos; lt; gt; /ConfigParamValue var str:String = String(XPath.selectNodes(MyXML_cs.getResults(), //ConfigParamValue/text())[0]); I've tried: trace(A: + escape(str));// Special Character - amp; quot; apos; lt; gt; trace(B: + unescape(str)); // Special Character - amp; quot; apos; lt; gt; trace(C: + decode(str));// Special%20Character%20%2D%20%26amp%3B%20%20%26quot%3B%20%20%26apos% 3B %20 %20%26lt%3B%20%20%26gt%3B%20%20 trace(D: + encode(str));// Special Character - amp; quot; apos; lt; gt; I'd greatly appreciate if someone could let me know how to decode this text! Thank you! Doug Coning Senior Web Development Programmer FORUM Solutions [EMAIL PROTECTED] This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply to sender's e-mail address with notification of the error and then destroy this message in all electronic and physical forms. ___ 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
RE: [Flashcoders] DECODE XML Encoded Characters?
Yes please. I use extensive use of the XPath class and would appreciate it. Thanks, Doug Coning -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Monday, September 25, 2006 12:20 PM To: Flashcoders mailing list Subject: RE: [Flashcoders] DECODE XML Encoded Characters? That decodeEntities function is actually taken from a class I wrote to overcome some annoyances with xfactorstudios Xpath implementation. So in part of the class I just use that private function as needed in a getString function I wrote which returns a string (also works with CDATA): public function getString(path:String, CDATA:Boolean):String{ var returnValue:String; if(CDATA){ returnValue = XMLNode(XPath.selectNodes(this.XMLObj, path+/text())[0]).nodeValue; }else{ returnValue = String(XPath.selectNodes(this.XMLObj, path)[0]); } return decodeEntities(returnValue); }; I can send you the class offlist if you like. Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Doug Coning Sent: Monday, September 25, 2006 12:12 PM To: Flashcoders mailing list Subject: RE: [Flashcoders] DECODE XML Encoded Characters? Thanks Jason, Yes, this does parse it correctly not so much because of the parseXML step, but because of the nodeValue. I've been using the XPath class to return my XML by using the selectNodes method. Apparently, this doesn't parse the xml in the same manner as the nodeValue function does. I wonder if there is a way to get the XPath class to return the XML in the decoded manner like the nodeValue method does? Thanks again! Doug Coning -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Merrill, Jason Sent: Monday, September 25, 2006 11:23 AM To: Flashcoders mailing list Subject: RE: [Flashcoders] DECODE XML Encoded Characters? If this is related at all, or helps any, this is what I use to decode entities from an XML string - someone on this list suggested using XML.parseXML() private function decodeEntities(entityString:String):String { var x:XML = new XML(n+entityString+/n); x.parseXML(); return x.firstChild.firstChild.nodeValue; }; Jason Merrill Bank of America Learning Organization Effectiveness - Technology Solutions -Original Message- From: [EMAIL PROTECTED] [mailto:flashcoders- [EMAIL PROTECTED] On Behalf Of Doug Coning Sent: Monday, September 25, 2006 11:16 AM To: Flashcoders mailing list Subject: [Flashcoders] DECODE XML Encoded Characters? Alright, what am I doing wrong? I have tried over and over to decode an XML string, but Flash won't decode it. The XML is returning special Characters (') encoded. I have tried to use escape, unescape, encode, decode and I can't get anything to convert the encoded text to its character representation. Here is the node: ConfigParamValueSpecial Characters - amp; quot; apos; lt; gt; /ConfigParamValue var str:String = String(XPath.selectNodes(MyXML_cs.getResults(), //ConfigParamValue/text())[0]); I've tried: trace(A: + escape(str));// Special Character - amp; quot; apos; lt; gt; trace(B: + unescape(str)); // Special Character - amp; quot; apos; lt; gt; trace(C: + decode(str));// Special%20Character%20%2D%20%26amp%3B%20%20%26quot%3B%20%20%26apos% 3B %20 %20%26lt%3B%20%20%26gt%3B%20%20 trace(D: + encode(str));// Special Character - amp; quot; apos; lt; gt; I'd greatly appreciate if someone could let me know how to decode this text! Thank you! Doug Coning Senior Web Development Programmer FORUM Solutions [EMAIL PROTECTED] This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply to sender's e-mail address with notification of the error and then destroy this message in all electronic and physical forms. ___ 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 This e-mail and any attachment(s) are intended for the specified recipient(s) only and are legally protected. If you have received this communication in error, please reply