7

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?

8
  • Wiki or Programmers, if you must ask this question. But I think it's pretty subjective.
    – AllenG
    CommentedJun 15, 2011 at 0:13
  • 7
    Learn both. Both are important.
    – alex
    CommentedJun 15, 2011 at 0:14
  • 9
    If you're already a web developer, how much learning is there really to do in order to pick up XML?
    – Pointy
    CommentedJun 15, 2011 at 0:17
  • 6
    Surely you mean AJAJ? The X in AJAX stands for XML.CommentedJun 15, 2011 at 8:14
  • 1
    @PaulButcher It stands for XMLHttpRequestObject which is a silly name for it given that XML is in no way shape or form required to make use of an XHR object.CommentedJul 4, 2013 at 3:56

9 Answers 9

12

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.

    7

    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.

      5

      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.

      5
      • 2
        I'm not so sure. I've switched to JSON for storing configuration data in most of my programs.CommentedJun 15, 2011 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
        CommentedJun 15, 2011 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.CommentedJun 15, 2011 at 0:31
      • 1
        XML is pretty terrible for configuration data, and has been avoided by newer frameworks.CommentedJun 15, 2011 at 4:13
      • 1
        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.CommentedJul 4, 2013 at 4:01
      4

      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.

        3

        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.

        1
        • 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
          CommentedJun 15, 2011 at 0:34
        2

        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.

          1

          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...

            0

            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.

              0

              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.

                Start asking to get answers

                Find the answer to your question by asking.

                Ask question

                Explore related questions

                See similar questions with these tags.