Ramon,

I need to search an XML via a string that may contain apostrophes.

ex.:

var sDesc:String = XPath.selectNodes(_xml, "//[EMAIL PROTECTED]'" +
sReleasedLabel + "']/@writeup")[0];

Is there a way to escape the apostrophe?  The problem is that the
sReleasedLabel, which contains "Chinese New Year '06", is thought to
end at "... Year " because of the apostrophe.

I've tried "/" and "\" as escape chars but they don't work.

You should be able to use double quotes surrounding the expression you are looking for...

XPath.selectNodes(_xml, "//[EMAIL PROTECTED]"" + sReleasedLabel + "\"]/ @writeup")[0];

This is something that wouldn't work in an xpath statement in an XML file, but you should be able to get away with it in ActionScript depending on whether the xpath library you are using supports this notation.

Other than that there is no solution to your problem. Better to encode your attribute values so that they contain ' instead of apostrophe characters.

Cheers,

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

Reply via email to