SummersRemote / xmlToJSON

simple javascript utility for converting xml into json

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Different parsing in IE8 vs. Firefox v34.05

julkue opened this issue · comments

In Firefox, the head from my XML document will be parsed like this:

        "xmlns:xsi": {
          "_value": "http://www.w3.org/2001/XMLSchema-instance",
          "_ns": "http://www.w3.org/2000/xmlns/"
        },

in IE8 the head from the XML document will be parsed like this:

      "_attr": {
        "xmlns:xsi": {"_value": "http://www.w3.org/2001/XMLSchema-instance"},

It is not important for me to have the _ns attribute, but imho the parsing should be the same in all browsers!

I don't have a copy of IE8 lying around, so I can't test this behavior. It looks as though the xmlns option is being set differently. Can you verify that in each case, the xmlToJson configuration options are the same?

I've tested with the default values, so without any custom settings.

Try setting the xmlns option to false. This should force consistent behavior between the two browsers. It looks as though IE 8 doesn't properly support the namespaceURI attribute. If so, it's forcing the evaluation to false. Let me know.

After setting xmlns = fase the difference between Firebox and IE will be:
Firefox:

      "_attr": {
        "xmlns:xsi": {"_value": "http://www.w3.org/2001/XMLSchema-instance"},
        "noNamespaceSchemaLocation": {"_value": "../xsd/HTMLVideoMapper.xsd"}
      },

IE8:

      "_attr": {
        "xmlns:xsi": {"_value": "http://www.w3.org/2001/XMLSchema-instance"},
        "noNamespaceSchemaLocation": {
          "_value": "../xsd/HTMLVideoMapper.xsd",
          "_ns": "http://www.w3.org/2001/XMLSchema-instance"
        }
      },

So in fact setting the xmlns will not affect changes between those browsers

It looks as though the output is consistent. IE added the _ns value, but the object naming and values are otherwise identical which should give consistent and predictable behavior between browsers. I will update the documentation to indicate that the library is intended for IE9+ and close this issue.

Well, that's open source and you have the right to change requirements. But for me, that means a huge problem since I already started to implement your plugin today. Each XML2JSON-converter plugin will use different ways to handle attributes, texts, values and namespaces. So I will need to complete develop the enhancement again.
My target browser is IE 8 since it is a customer requirement. So for me that would mean, you are switching from IE7+ to IE9+ and killing the work of today.

For my understanding: What is the problem why there are such differences betwen IE8 and Firefox? Also, are there more things/features than namespaces that can be different in each browser?

The difficulty lies in Microsoft’s support for DOM standards in IE8. The situation greatly improved with IE9. IE10+ are significantly better. Chrome, Firefox, and Safari implemented the DOM methods for XML much more rapidly and so support appears in earlier versions.

I updated the documentation to reflect that the library will work as expected for IE9+ . I also stated in the docs that the library can be reasonably and predictably used with IE 7 and 8 if you set the xmlns option to false.

I hope this helps, and I apologize if it does not. If you would like to submit a patch, I’d be happy to consider it. For now though, I have no intent of supporting outdated and non-standard browsers.

Best luck with your endeavors.

On Jan 28, 2015, at 12:47 PM, Julian notifications@github.com wrote:

Well, that's open source and you have the right to change requirements. But for me, that means a huge problem since I already started to implement your plugin today. Each XML2JSON-converter plugin will use different ways to handle attributes, texts, values and namespaces. My target browser is IE since it is a customer requirement. So for me that would mean, you are switching from IE7+ to IE9+ and killing the work.

For my understanding: What is the problem why there are such differences betwen IE8 and Firefox? Also, are there more things/features than namespaces that can be different in each browser?


Reply to this email directly or view it on GitHub #6 (comment).

The only thing left I don't understand is why setting xmlns to false will fix the differences from IE8 to Firefox. For me setting the value to false means that there should not appear any namespace attributes. But in IE8 those still exist (see my last example).
What am I missing? Why is settin xmlns to false a solution in this situation?