S
SteveYoungTbird
I apologize if this is slightly of topic, please feel free not to answer
it if you feel that it is.
I have been using the BadgerFish convention to translate an XML document
into a JSON object. The convention rules are here
http://badgerfish.ning.com/ and they are summarized below:
The Rules
* Element names become object properties
* Text content of elements goes in the $ property of an object.
* Nested elements become nested properties
* Multiple elements at the same level become array elements.
* Attributes go in properties whose names begin with @.
* Active namespaces for an element go in the element's @xmlns property.
* The default namespace URI goes in @xmlns.$.
* Other namespaces go in other properties of @xmlns.
* Elements with namespace prefixes become object properties, too.
This works perfectly in Firefox but because the namespaces go in
properties of @xmlns, IE6 throws a "conditional compilation is turned
off" error when working with the resulting JSON object. It doesn't like
the "@".
I googled around and found a possible solution at
http://msdn.microsoft.com/en-us/library/5y5529x3(VS.71).aspx which
suggests adding /*@cc_on @*/ to the beginning of the code. I have tried
this and now it still works in Firefox but gives a "Expected identifier"
error in IE6.
Here are links to two scripts, one with /*@cc_on @*/ at
http://members.chello.at/stephen.joung/testsite/indexJSON_ShowProperties1.html
and one without at
http://members.chello.at/stephen.joung/testsite/indexJSON_ShowProperties1.html
The file test is a straightforward JSON file without namespaces and
test4 has namespaces. Both scripts work in FF but give the errors
mentioned above in IE6
So I have two questions:
1) Can Badgerfish converted JSON with namespaces be used with IE? if so how?
2) Is there another method of converting XML to JSON which can deal with
namespaces known to and recommended by the experienced people in c.l.j.?
Thanks for any assistance,
Steve.
it if you feel that it is.
I have been using the BadgerFish convention to translate an XML document
into a JSON object. The convention rules are here
http://badgerfish.ning.com/ and they are summarized below:
The Rules
* Element names become object properties
* Text content of elements goes in the $ property of an object.
* Nested elements become nested properties
* Multiple elements at the same level become array elements.
* Attributes go in properties whose names begin with @.
* Active namespaces for an element go in the element's @xmlns property.
* The default namespace URI goes in @xmlns.$.
* Other namespaces go in other properties of @xmlns.
* Elements with namespace prefixes become object properties, too.
This works perfectly in Firefox but because the namespaces go in
properties of @xmlns, IE6 throws a "conditional compilation is turned
off" error when working with the resulting JSON object. It doesn't like
the "@".
I googled around and found a possible solution at
http://msdn.microsoft.com/en-us/library/5y5529x3(VS.71).aspx which
suggests adding /*@cc_on @*/ to the beginning of the code. I have tried
this and now it still works in Firefox but gives a "Expected identifier"
error in IE6.
Here are links to two scripts, one with /*@cc_on @*/ at
http://members.chello.at/stephen.joung/testsite/indexJSON_ShowProperties1.html
and one without at
http://members.chello.at/stephen.joung/testsite/indexJSON_ShowProperties1.html
The file test is a straightforward JSON file without namespaces and
test4 has namespaces. Both scripts work in FF but give the errors
mentioned above in IE6
So I have two questions:
1) Can Badgerfish converted JSON with namespaces be used with IE? if so how?
2) Is there another method of converting XML to JSON which can deal with
namespaces known to and recommended by the experienced people in c.l.j.?
Thanks for any assistance,
Steve.