Built-in DOM browsers VS. Jarscript framework Parsers

I am diving into javascript and one of the concepts I am playing with is XML parsing. I see IE has its own parser, just like Firefox does. I also see XML parsers built into some of the javascript frameworks like JQuery. My questions...

  • What's the most common or best way to parse XML with javascript these days?
  • If I use the built-in MS and Firefox parsers, does that mean that my code is guaranteed to only work in IE and Firefox, or will other popular browsers work?

Thanks in advance for your wisdom!

EDIT * I ​​just found this discussion , very similar to my question ..

+2


source to share


3 answers


What's the most common or best way to parse XML using javascript these days?

I would use a parser framework to avoid writing code depending on the browser.

If I use the built-in MS and Firefox parsers, does it mean that my code is only guaranteed to work in IE and Firefox, or other popular browsers also work?



Each browser has its own way of loading and processing XML.

For example,

IE uses an ActiveX object to load XML, but firefox does not.

+1


source


The DOMParser interface exists in every major browser and has many advantages over js implementations - speed and correctness are great.



+1


source


Sarissa is a JS library that helps abstract away some of the differences between browser API calls.

Sarissa is an ECMAScript library acting as a cross-browser browser for native XML APIs. It offers various product related XML such as Document instantiation, XML loading from URLs or strings, XSLT transformations, XPath queries, etc. handy for people doing what's lately known as "AJAX".

Supported browsers - Mozilla - Firefox and family, Internet Explorer with MSXML3.0 and higher, Konqueror (KDE 3.3+), Safari and Opera. Konq and Safari do not offer XSLT / XPath scripting support AFAIK.

0


source







All Articles