View Full Version : expat, Getting contents of a tag

02-28-2003, 04:11 AM
Hello, I am working with an xml conversion that puts the contents of the <item> tag in quotes and uses it in a javascirpt. The only problem is, the contents of the <item> tag might contain its own quotes, Is there a way that I can, when I parse the beginning of the <item> tag, parse all the way through to the end of the tag and change the " to \"? Thanks a lot.
<item>Everyone say "Hello!"</item>
would need to be converted into:
"Everyone say \"Hello!\""

02-28-2003, 05:17 AM
can you not just addslashes() before printing ?

02-28-2003, 07:59 PM
If you only want to add slashes to the quotation marks you can try the str_replace() function.