+ 175

What are the advantages of creating web pages with XML instead of HTML?

From time to time, I see web pages whose content is solely written in XML (not HTML or XHTML). These pages usually have some style sheets (either XSLT or CSS) attached to them which makes them look like any other ordinary web page. My question is, what are the advantages of such an approach (if any), and why would anyone choose to work this way? EDIT: If this is a good thing, why is it not widespread? EDIT 2: Thanks everyone for the great responses. They really enlightened me.

7th Apr 2017, 6:18 PM
Kingsley Ebong
Kingsley Ebong - avatar
91 Answers
+ 168
*.XML is the acronym from Extensible Markup Language (meta-language of noting/marking). XML is a resembling language with HTML. It was developed for describing data. *.The XML tags are not pre-defined in XML. You will have to create tags according to your needs. *.XML is self descriptive. *.XML uses DDT principle (Defining the document Type) to formally describe the data. *.The main difference between XML and HTML: XML is not a substitute for HTML. XML and HTML were developed with different purposes: *.XML was developed to describe data and to focalize on what the data represent. *.HTML was developed to display data about to focalize on the way that datalooks. *.HTML is about displaying data, XML is about describing information.*.XML is extensible.
12th Apr 2017, 12:24 PM
Prince Saini
Prince Saini - avatar
+ 117
A web developer could prefer using XML instead of HTML if he wants to organize the data and avoid format incompatibility, so the data in the website is available to all kinds of device systems (upgraded systems or not). For example, you are trying to open a PDF file and you don't have a program that can actually read this format. XML should also be used if you want to store users' data or share data, as this data is stored in plain text. It allows other people to use the data in a more efficient way. For example, Twitter makes good use of XML by sharing all the information on the site through XML, that's one of the reasons why there are so many Twitter programs out there. Imagine you are an architect and you were given a drawing of a building instead of the blueprint, you will need to get the correct format with detailed and technical information to fully understand it. So yeah, it's more about data structure.
14th Apr 2017, 7:16 AM
Pao
Pao - avatar
+ 35
Hey KEsSiE! Here's what I've heard about it. HTML (HyperText Markup Language) focuses on the appearance of data, whereas XML (eXtensible Markup Language) focuses on the data itself, i.e. it's a framework (base). You can use HTML to display data and XML to transport it.
12th Apr 2017, 6:25 PM
AtK
+ 28
Kessie, XML is not used for building out web pages as we know them. You don't define html tags inside an XML document. XML does not render your instructions by converting them into stacked blocks of various div sizes, color and fonts. It is important that we draw a fat line between html and xml to not confuse anyone. The two are implemented differently and are not like the other in any way. HTML/CSS allows you to organize and prettify your website. XML allows you to organize the data for your website. XML is mostly found, but not limited to, in dynamic web development where you have your frontend html/css, backend php/python/java/etc, and the database layers. You may see XML being used in API and microservice based apps even though JSON may be more appropriate. This allows other websites that run on different technologies access to your sites data. And it allows them to style it however they like. Think Yahoo Weather API. The developers at yahoo created APIs that allow us to access their weather data. This data is output in json format but it could have very well been XML. We can then suck in the data depending on the locations we pass to it and finally style the output to our liking on either web or mobile platform.
19th Apr 2017, 12:33 PM
Emir Memic
Emir Memic - avatar
+ 19
XML Web Pages can easily be changed into a Web Application...
14th Apr 2017, 5:26 AM
Femyk
Femyk - avatar
+ 19
XML pages enable "smart" searching. For instance if u desire to search for chips (chocolate chips) on an xml page u are more likely to get the closest result unlike html which might return results on wood chips, a guy named chip and so on
19th Apr 2017, 5:51 PM
David Akhihiero
David Akhihiero - avatar
+ 15
HTML attempts to control the appearance and presentation of data, while XML does not.  XML defines data separately from its presentation.  This makes XML data easier to locate and manipulate. 
23rd Apr 2017, 8:59 AM
Osama Ibrahim
Osama Ibrahim - avatar
+ 14
Am really surprise to hear its possible to use XML to build website. Or do you mean XHTML?
14th Apr 2017, 8:54 AM
Oyeniyi Abiola Peace
Oyeniyi Abiola Peace - avatar
+ 14
XML is a syntax: it defines how you write data, but not what data you can write.  HTML is a vocabulary: it defines what kinds of elements you can write
19th Apr 2017, 11:12 PM
Yassine Farhi
Yassine Farhi - avatar
+ 13
XML and html are used basically for different purposes. HTML is used for displaying the content, it is more about the structure of a website whereas XML is used for data description and transportation. You can also use HTML to represent the data but in some aspect it is recommended to use XML database. As mentioned before XML is widely used for data transportation between services. Since xml is machine readable, another advantage is semantic web.
14th Apr 2017, 10:48 PM
Mowlana
Mowlana - avatar
+ 12
Hahaha ! such a cute question Dear Friend, I guess by reading others answers you now know what is what but you should understand the real purpose of XML and HTML Why are we describing our data(using XML) and for whom, XML has meta data of a website or a webpage. We use it for Web crawlers to identify our website so that we stay high on rankings and compete against our competitors website. Everything boils down to bringing valid traffic to your website. XML content helps GOOGLE, BING and other search engines to keep track of the content of ur site, not only this RSS (Rich Site Summary) uses XML to give us notification for the updated content for our subscribed website. Thank you.
19th Apr 2017, 8:08 PM
Akash Singh
Akash Singh - avatar
+ 11
XML works great for search engine sitemap creation/use.
19th Apr 2017, 1:03 AM
Daniel William Rutter
Daniel William Rutter - avatar
+ 10
One possible advantage would be for use of the data of the page in something other than a web browser; that would (presumably) be easier to do if a page's content were well-formed XML. Of course in theory a well-formed, semantic XHTML page should be nearly as able to be parsed, as well. It can also be easier to generate XML instead of XHTML, depending on the data source.
19th Apr 2017, 4:08 PM
Prashant Kansal
Prashant Kansal - avatar
+ 9
AFAIK. The styleheet converts the xml into xhtml, so it is still html what you're lookin at. Only this is done in the browser instead of on the server. Personally, I don't understand it either though one of the biggest problems is support in IE. I remember creating a skeleton ecommerce site sometime in the past that serves XML, transformed by XSLT and styled using CSS. I sorely missed the ability to use XLink and other wonderful XML features. It's also nice to be able to tag the data for what it is. I used a 'menu' tag for the restaurant menus. 'price' tags for prices and so on. If a user clicked on a link to change menus, all I had to do was send the name of the item, the price and the description instead of the complete page. iirc, a 4K or more HTML menu page was only 200 bytes of sent data. One major issue with xml is that one single error makes everything crash in xml, but for me, that isn't much of a problem because, it's actually the same in any other programming language out there, so proper coding should be no bother for programmers and careful HTML/CSS types. Some people might say that what I did in the e-commerce site was actually XHTML... But, seriously? No!! I served XML, I did call up XHTML namespaces when needed for links, images and HTML type things but this was done only when necessary.
19th Apr 2017, 8:47 PM
Emmanuel Austin Nwokoma
Emmanuel Austin Nwokoma - avatar
+ 8
A language that still works if it has errors in them isn't a better one. Just because you can't see the error doesn't mean it's not there which is even worse. If you don't code clean in html you can really fuck up your code without you noticing and this will bite you in the ass later. Also putting broken code online is never a good idea since it's a security risk!
13th Apr 2017, 11:02 PM
TransHedgehog
TransHedgehog - avatar
+ 8
XML is an extensible markup language and that means it is best used when you need to just write the XML once and then apply a style sheet (XSLT Extensible Stylesheet Language Transformations) and transform it into HTML for web pages, plain text or XSL Formatting Objects, which may subsequently be converted to other formats, such as PDF, PostScript and PNG. That ways you need to just maintain one document.
19th Apr 2017, 5:26 PM
Wilbur Pereira
Wilbur Pereira - avatar
+ 7
XML provides a mechanism to define your own tags.
19th Apr 2017, 3:58 PM
JULIUS FREDRICK
JULIUS FREDRICK - avatar
+ 7
XML makes it easier to transport data across platforms, which is why it was used in a lot of API's prior to the emergence of json and other languages for API development. HTML is generally preferred for websites as it's more user friendly and standardized
19th Apr 2017, 4:27 PM
Steve Halvorson
Steve Halvorson - avatar
+ 7
I see web pages whose content is solely written in xml insted of html..these pages usually have some style sheets attached to them which males them look like any other ording page..it is eaiser to generate it programatically and reuse it for other purpose than displaying webpage..
20th Apr 2017, 9:41 AM
arpithagowda
arpithagowda - avatar
+ 6
XML and HTML although different can be combined to add more info and database structures to your web pages. HTML alone though is pretty basic for the sake of creating static webpages (along with the use of CSS)
16th Apr 2017, 8:46 PM
Kostas Athanasopoulos
Kostas Athanasopoulos - avatar