aspose file tools*
The moose likes XML and Related Technologies and the fly likes difference between JavaScript and XML Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "difference between JavaScript and XML" Watch "difference between JavaScript and XML" New topic
Author

difference between JavaScript and XML

Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
hi,
I am new to XML. The format is similar to JavaScript embodded in HTML. What is the difference? Please clarify.
Simon
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
I'm new to XML too, but probably know a little better than you.
A suggestion: go to W3Schools for XML and JavaScript both will answer your question here. I just went through the XML, XSL schools during the new year break.
Happy learning!
Roseanne
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Here are some differences

  • XML is often used to represent "raw" data. JavaScript on the otherhand, is a part of content-rendering language more specifically designed for presentation of the data.
  • JavaScript is "heavy" because of inline Javacode. Content rendering involves compilation cycles. XML on the otherhand is "light" because it defines just the data, is language independent and doesnt require compilation( validation, XSP in XSL are exceptions )
  • JavaScript can only use "allowed" keywords on the otherhand in XML you can define your own tags which makes it more flexible than JavaScript.

  • Bottomline, these two are orthogonal technologies. They are meant for different purposes and are not mutually exclusive. Though JavaScript can be used to make XML presentation more efficient( XSL, HTML and javaScript can be used together, ) there are alternate and more efficient ways to achieve the same flexibility. Take a look at XSP and you'll know what I am talking about.
    Ajith

    [This message has been edited by Ajith Kallambella (edited January 03, 2001).]


Open Group Certified Distinguished IT Architect. Open Group Certified Master IT Architect. Sun Certified Architect (SCEA).
Roseanne Zhang
Ranch Hand

Joined: Nov 14, 2000
Posts: 1953
Ajith
XSL, HTML and javaScript can be used together

Can you give a very simple example on it. I am looking for it actually. When I transfer my table data to an XML island, I lost some features of the original presentation, and do not how to get it back.
Another point: to my understanding, Java is portable code, and XML is portable data, not metadata. Meta data is data decribe the (real) data, such as attribute of XML tags. Correct me if I'm wrong.
Thanks!
Roseanne
[This message has been edited by Roseanne Zhang (edited January 03, 2001).]
Ajith Kallambella
Sheriff

Joined: Mar 17, 2000
Posts: 5782
Yes, you are right about the metadata part. I stand corrected. Infact I think it is right to refer to both DTD or the XML Schema as the metadata for the data in XML.
XSL can act as a container for embeded HTML tags( but they should confirm to the well-formed XML rules ) and inline JavaScript. For examples, you may want to consult some good XML/XSL book. I read a little bit about it in the "Java and XML" book by O'Reilly. If you have the book, you may get some examples of it but it focuses mainly on usage of XML in Java appliations.
Thanks!
Ajith
Simon Xu
Ranch Hand

Joined: Aug 16, 2000
Posts: 235
Hi, Ajith & Roseanne,
Thanks for your useful link and clear expl.
I will go deeper from here,
Simon
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: difference between JavaScript and XML
 
Similar Threads
difference between getElementById and getElementByName?
What is Ajax stand for ?
How to avoid server calls in Sorting
Consume web service in javascript
window.refresh & window.location.reload