Re: Quotes in strings sent to JavaScript
Re: Quotes in strings sent to JavaScript
- Subject: Re: Quotes in strings sent to JavaScript
- From: "Mark J. Reed" <email@hidden>
- Date: Thu, 29 Nov 2007 08:48:24 -0500
> I suspect the \" escaped quotes are messing up the JavaScript interpreter
> but I don't know how to get rid of them.
I believe you have it backwards. Your command:
set the_JavaScript to "this.metadata = " & my_XML_string & ";"
Becomes this by the time JavaScript sees it:
this.metadata = <XML string goes here>;
And that's illegal Javascript: you need quotation marks around the
whole XML string. Fortunately, since JavaScript (unlike AppleScript
and XML) allows single quotes as well as double ones, you can avoid
the whole quoting-the-quoted-quote issue by using them:
this.metadata = '<XML string goes here>';
which, working backwards, makes the AS look like this:
set the_JavaScript to "this.metadata = '" & my_XML_string & "';"
--
Mark J. Reed <email@hidden>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden