3

I was wondering is there any need to use XML for large web projects, say in a social networking site?

Currently am just coding in normal PHP and HTML files. If I use XML files is that going to provide any convenience, like enhancing the processing speed of docs or reduce coding weight?

I don't know XML by now, also tell is it too much different from HTML?

user4853991
  • 99
  • 1
  • 8
  • `XML` is a data interchange format. Unless you need to exchange data with a 3rd party (`SOAP` web service?), you really have no need for it. Some frameworks use `XML` for various configuration files, but most have moved to other formats. – Kevin Nagurski May 01 '15 at 11:55

2 Answers2

3

Where HTML has a fixed set of tags with defined meaning, mostly relating to presentation, in XML you can define your own set of tags with meaning particular to your application or domain.

You probably don't need XML to get started building your social networking site, but down the road you could use it to export a user's social graph in a standard and readily processable form.

Do not look to XML for "enhancing processing speed or reducing coding weight." Look to it for standardized data exchange, especially for document-based data. (JSON will tend to work better for purely performance and coding weight goals; XML will work better for document-based data or where industry standard formats can be leveraged.)

kjhughes
  • 106,133
  • 27
  • 181
  • 240
  • But why will we use it to export – user4853991 May 01 '15 at 12:02
  • I mean in interactive sites we use php+mysql for data storage, and we can access whenever and wherever we want – user4853991 May 01 '15 at 12:03
  • 1
    You would offer the ability to export a user's data if you cared enough about your customers to help them avoid lock-in to your site. It might seem to be against your commercial self-interest, but customers might appreciate it enough to make it actually be a competitive advantage. – kjhughes May 01 '15 at 12:05
  • For example, Google provides this sort of ability to its customers via its [Takeout](https://www.google.com/settings/takeout) service, although XML is arguably underrepresented in the [formats they support](https://support.google.com/accounts/answer/3024195). – kjhughes May 01 '15 at 12:16
  • Am still not finding it of any use. Am not convinced – user4853991 May 01 '15 at 12:20
  • My goal is not convince you that you need XML; my goal is to inform you so you could make a good decision. – kjhughes May 01 '15 at 13:06
  • Yeah, well thanks a lot. U gave me a nice overview (y) of XML – user4853991 May 01 '15 at 13:09
2

XML is the same syntactically to xhtml, basically HTML but with certain extra constraints, it is not used to render web pages if that's what you're asking. (Unless you use XSLT)

Often used in Service Oriented Applications, you can use XML to provide your data to other services, apart from that, it's used in configuration. Imagine XML as a counterpart to JSON.

  • XML/JSON = Computer to Computer

  • HTML = Computer to Human

Thomas Nairn
  • 1,186
  • 8
  • 34