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 <string> that is misbehaving & 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:
>>>>
>>>><ConfigParamValue>Special Characters - & " ' <
>>>
>>>></ConfigParamValue>
>>>>var str:String = String(XPath.selectNodes(MyXML_cs.getResults(),
>>>>"//ConfigParamValue/text()")[0]);
>>>>
>>>>I've tried:
>>>>trace("A: " + escape(str)); // > Special Character - &
"
>>>>' < >
>>>>trace("B: " + unescape(str)); // > Special Character - &
"
>>>>' < >
>>>>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 - &
"
>>>>' < >
>>>>
>>>>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.
>>>>_______________________________________________
>>>>[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
>>
>>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.
>>_______________________________________________
>>[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