Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

This question already has an answer here:

Is it worth Learning XML as a web developer when JSON is better for AJAX? or is it better to concentrate on JSON/Javascript for AJAX?

share|improve this question

migrated from stackoverflow.com Jun 15 '11 at 0:15

This question came from our site for professional and enthusiast programmers.

marked as duplicate by gnat, jwenting, Bart van Ingen Schenau, MichaelT, Kilian Foth May 23 at 12:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

    
Wiki or Programmers, if you must ask this question. But I think it's pretty subjective. –  AllenG Jun 15 '11 at 0:13
6  
Learn both. Both are important. –  alex Jun 15 '11 at 0:14
8  
If you're already a web developer, how much learning is there really to do in order to pick up XML? –  Pointy Jun 15 '11 at 0:17
    
agree @alex = both should be understood, as they both have their place. Besides that, each type is really easy to work with, so "learning" either shouldn't take more than a couple small test projects. –  Bosworth99 Jun 15 '11 at 0:19
4  
Surely you mean AJAJ? The X in AJAX stands for XML. –  Paul Butcher Jun 15 '11 at 8:14

9 Answers 9

XML really is a pretty horrible way to represent structured data, but unfortunately it gets (ab)used quite a lot by a lot of developers and websites. So if you're only working with your own stuff, then by all means, stick to JSON and save yourself the hassle. But you still need to learn XML for those times when you end up having to interoperate with someone using an XML interface.

share|improve this answer

Both are important and relatively trivial to pick up. At the end of the day, you should know both as a web developer so you can choose the best solution for the specific problem at hand.

share|improve this answer

XML is used for more than just AJAX. For example, if you are doing any web services you will definitely encounter XML. Reading/writing configuration files? XML is often used there too.

My advice, however, is to learn enough about it to know when it is a good fit for any projects you might come across, and then do a deep dive when you actually have some work to perform using XML. If you learn it and then wait a long time before applying that knowledge then you will likely be forced to relearn it later anyway.

share|improve this answer
2  
I'm not so sure. I've switched to JSON for storing configuration data in most of my programs. –  Nathan Osman Jun 15 '11 at 0:23
    
@George Edison - You may have switched, but eventually you are going to be working with someone else's configuraiton file. Especially on the MS side, XML seems to be gaining favor for XCOPY deployable configuration. –  JohnFx Jun 15 '11 at 0:26
    
True... I guess other applications aren't jumping onto the JSON bandwagon... and that's also not to say XML is bad - just that it really isn't suited very well for storing configuration data. –  Nathan Osman Jun 15 '11 at 0:31
1  
XML is pretty terrible for configuration data, and has been avoided by newer frameworks. –  kevin cline Jun 15 '11 at 4:13
    
SGML-based syntax is nice for describing content and modelling content structure. Why the Java and C# communities latched on to it for as long as they have for damn near everything else is a complete mystery to me. –  Erik Reppen Jul 4 '13 at 4:01

Let's put the technical (overhead, etc) differences aside for a moment.

JSON is not always appropriate, nor does every client you deal with will want to transmit data to/from you via JSON. XML has its place and IMHO is still the preferred method of sharing data between different companies and platforms.

If for no other reason, learn XML because that's what may bring home the bacon.

share|improve this answer

Learn both, I guess I don't know what there is to learn though. Most server side languages will decode/encode json and xml. They are just different way of serializing and using data.

share|improve this answer
    
Yeah I wonder that sometimes too. What is there to learn anyway? I remember when I first listed XML on my resume it just felt so weird, but it's a buzzword people look for. –  jhocking Jun 15 '11 at 0:34

One pretty good reason for learning XML is the APIs. If your application is dependent on various external APIs then you are bound to use the output they provide, which most of the time are XML files in return (for example, MediaWiki, OpenStreetMap..etc). In such situations having some basic knowledge of the XML and its structure helps you save the day.

share|improve this answer

I don't have any experience with JSON, but I do want to add in my two cents about XML. First of all, making the statement that "XML" is easy to learn is quite a leap in my opinion. If by easy to "learn" you mean being able to understand the concept of XML elements and attributes and syntax rules, then sure. If by XML you are including most of the related technologies which actually make XML useful, such as DTD, namespaces, XPath, XSLT, XSL-FO, XQuery, etc., then I'm not so sure that it is "easy". I'm still trying to wrap my head around XSLT well enough to be able to start implementing it in my own work.

That aside, I definitely think that any web developer who wants to stay competitive and useful to the market needs to know XML proper and should be at least familiar with the related specifications.

share|improve this answer

Use JSON for Ajax calls. Learn XML when someone requires it. Until then, learn something more interesting and useful, like CSS or jQuery or HTML5.

share|improve this answer

I have used XML once during my web development studies at University. Haven't used it since (in about 3 years).

Found myself needing it this month for a new project and picking it up again after 3 years was a breeze...

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.