I am new to web programming and just started learning XML and AJAX. I am creating a social gaming website for my college project. I am confused at the point of using XML for AJAX in HTML5. As XHTML is replaced by HTML5 so is it ok to use XML or i should choose JSON (i know nothing about JSON but it is what I found in answers on web to the question related to choice between JSON and XML). My preference is XML because it is in my syllabus but I want to make sure that XML and HTML5 will not conflict.

  • Did you ever check what AJAX is an acronym for? The XHR API? The markup language won't affect the code, and if you control both ends of the client server relationship then code with what you are happy with for now.
    – JohnMark13
    Commented Sep 9, 2013 at 15:04
  • You can use any kind of serialized data, XML, JSON, CSV, INI. JSON seems to be standard de facto this days, since it's much more readable and native to JavaScript. Commented Sep 9, 2013 at 15:04
  • 1
    this post is rather hard to read (wall of text). Would you mind editing it into a better shape?
    – gnat
    Commented Sep 9, 2013 at 15:22

1 Answer 1


You can encode the data sent to the server in any format you want and not interfere with the web page's standards.

The idiomatic thing to do is to just use JSON these days, but that is up to you.

It's also important to note that if you use a non HTML5 tag, the police aren't going to show up at your door and, unless your professor validates your site using a tool, he probably won't notice and it will render just fine.

Certain things in your page like <br> being more HTML5 compatible than <br/> will break XML compatibility, if that's what your asking. But the standard still leaves a clause allowing full XML compatibility in order to allow any page to comply with XML, AFAIK. Though, from the discussion in that thread, this is explicitly for backwards compatibility purposes with the older HTML standards.

  • shall i go deeper in XML before learning and starting use of AJAX or just a basic knowledge of XML schema, DTD etc will give me some base to dive into AJAX Commented Sep 9, 2013 at 15:34
  • I should note that I think the term "XMLHttpRequest" was invented at a time when people thought XML was going to be the world's permanent, universal data-as-text storage format. The truth is, AJAX usually has little to do with XML. In modern days, HTML doesn't even have much to do with XML. While the basics of how XML works are useful to know, you do not need to understand the internals of DTD's, schemas, XSLT...and other stuff that a lot of programmers tend not to get so involved with.
    – Katana314
    Commented Sep 9, 2013 at 15:38
  • "DTD's, schemas" To reinforce your point, programmers didn't even define these when using XML years ago. They can be helpful for public APIs (things like XAML), but are relatively useless for a 1-off transport situation
    – brian
    Commented Sep 9, 2013 at 15:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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