+ 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.
89 odpowiedzi
+ 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.
+ 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.
+ 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.
+ 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.
+ 19
XML Web Pages can easily be changed into a Web Application...
+ 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
+ 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.
+ 14
Am really surprise to hear its possible to use XML to build website. Or do you mean XHTML?
+ 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
+ 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.
+ 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.
+ 11
XML works great for search engine sitemap creation/use.
+ 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.
+ 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.
+ 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!
+ 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.
+ 7
XML provides a mechanism to define your own tags.
+ 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
+ 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..
+ 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)