Internet Explorer "conditional compilation is turned off"

619 views
Skip to first unread message

SteveYoungGoogle

unread,
Jan 2, 2009, 4:57:43 PM1/2/09
to JSON Schema
I hope I am posting to the correct forum, but I have had no luck so
far at c.l.j. If not could someone please tell me where would be best
to post such a query.

I have written a small Javascript script to read through the
properties of a JSON file which includes namespaces.The JSON file was
converted from xml using the Badgerfish convention utilizing the tool
to be found here http://badgerfish.ning.com/

The script and JSON file work and don't give any errors in Firefox/
Firebug but give a "conditional compilation is turned off" error in
IE6.

Is the problem my script or the JSON file or IE?

The script is at http://members.chello.at/stephen.joung/testsite/indexJSON_ShowProperties5.html
Please click on the button"Click to load the JSON menu file" and the
JSON file will be loaded.

The JSON file is at http://members.chello.at/stephen.joung/testsite/test10.json
in case you would like to check it.

Thanks, Steve.

Toby A Inkster

unread,
Jan 3, 2009, 5:42:03 AM1/3/09
to json-...@googlegroups.com
On 2 Jan 2009, at 21:57, SteveYoungGoogle wrote:

> The JSON file is at http://members.chello.at/stephen.joung/testsite/
> test10.json
> in case you would like to check it.


IE has a funny feature called conditional compilation in its Jscript
engine. It is a set of directives which begin with @-symbols which
allow the JIT compilation of certain segments of Javascript to be
suppressed based on particular conditions. That is, these bits of
code will be ignored. Similar to pre-processor instructions for C
compilers.

Your JSON file includes "@xmlns" and "@currency". Although these are
not conditional compilation directives, they are valid conditional
compilation variable names. Now, I'm no expert on IE's Jscript
engine, but I believe that your "look" function tries to access
properties using the obj.prop syntax, rather than obj["prop"]. In the
case of the properties "@xmlns" and "@currency", IE interprets that
as an attempt to use conditional compilation, but as you've not
switched conditional compilation on (using the "@cc_on" directive),
this fails. The solution would be to use obj["prop"] syntax in look.

To be honest, Firefox should complain too, because I'm pretty sure
that the obj.prop syntax is illegal unless the property name is a
valid ECMAScript token name, which I believe "@xmlns" is not.

--
Toby A Inkster
<mailto:ma...@tobyinkster.co.uk>
<http://tobyinkster.co.uk>

SteveYoungGoogle

unread,
Jan 3, 2009, 1:43:01 PM1/3/09
to JSON Schema


On Jan 3, 11:42 am, Toby A Inkster <m...@tobyinkster.co.uk> wrote:
> On 2 Jan 2009, at 21:57, SteveYoungGoogle wrote:
>
> > The JSON file is athttp://members.chello.at/stephen.joung/testsite/
> <mailto:m...@tobyinkster.co.uk>
> <http://tobyinkster.co.uk>

Thanks Toby, I have fixed the problem now according to your suggestion
and everything is working in both FF and IE. This thing has been
bugging me for weeks.

Thanks again, Steve.

Reply all
Reply to author
Forward
0 new messages