permaculture playing cards
The moose likes HTML, CSS and JavaScript and the fly likes javascript vs java XML parsers Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "javascript vs java XML parsers" Watch "javascript vs java XML parsers" New topic

javascript vs java XML parsers

s penumudi
Ranch Hand

Joined: Nov 17, 2004
Posts: 113

I was just exploring more on Javascript XML Parser, Xpath and XSL.
When I compare two approaches of using Javascript parsers with that of the Java parsers, I see advantages using java parsers.

Disadvantages When Parsing using Javascript:
1. Cross Browser compatibility: Well know Issue. Some browsers does not support all the parsers.
2. Security: XML is downloaded on to the client machine. If the document contain any sentitive data then it will be on client machine unless temporary files are deleted.

Advantages of using Browser parsers using Javascript:
1. Asynchronous requests: XMl documents returned by asynchronous requests using AJAX technology can be parsed and shown to the user on the fly.

Advantages Java parsers:
1. XML documents are not downloaded on the client machine but parsed at the server side and html is returned to the client through response object.
2. Asynchronous requests still can be made using AJAX technology, but instead of sending XML documents, send html back to the browser. (I haven't tried this but I think it is possible). (We can have UI renders classes that will parse these XML documents and apply any stylesheets necessary. I am not sure how fast this would be).

Did anyone compare these two approaches? and which one do you think is better?

Any thoughts?
Eric Pascarello

Joined: Nov 08, 2001
Posts: 15385
Use the server since not every browser supports transformations by the browser, plus JavaScript can be turned off, the server can't.

I have an example in my book (ajax In Action) to do transformations to show it can be done, but I had to say it only worked in certain browsers. Sorts of limits your audience.

s penumudi
Ranch Hand

Joined: Nov 17, 2004
Posts: 113
Thanks a lot Eric.

I did read "AJAX In Action" and I liked it a lot. It gave good exposure on Patterns and security.

Thank you for your response.
I agree. Here's the link:
subject: javascript vs java XML parsers
It's not a secret anymore!