XML, XHTML, and HTML4

I’m wondering what exactly the history of XML is.

I’m also wondering the difference between XHTML and HTML4 is. Is XHTML still HTML? Just a different version? Or is it…XML (whatever that is).

Help please?
~TehYoyo

Check out this forum’s sticky thread on the same topic:

So then what is XML? Is it a really old language?

~TehYoyo

No, it’s a very important language. See if thses help:

http://www.whatisxml.org/

And, although w3shcools is not in vogue these days, this is a fairly clear intro:

http://www.w3schools.com/xml/xml_whatis.asp

But is it old? What came first, HTML or XML?

~TehYoyo

HTML is a little older than XML, but they have slightly different purposes. There’s plenty you can read online about this.

I’m confused about when W3schools says that XML doesn’t do anything…what do they mean? Is it meant to be interpreted directly by the reader of the XML (that is, should we interpret something like:


<to>Ralph.m</to>
<from>TehYoyo</from>

as to Ralph.m from TehYoyo? That is, does the recipient of XML have to read the code or is it displayed in some form.

I also read in one of the articles (can’t remember where) that XML is an application language…is this like a program? How does it make a program if it doesn’t do anything? Or is this just a w3schools screw-up?

Thanks for patience. I can tell it’s wearing thin :smiley:
~TehYoyo

XML does nothing. Its up to an application to take XML and do something with it. XML just creates a structure for parsing. On other words, it is a series of rules that are highly generalize allowing it to be used for multiple applications. For example: SVG, XPS, XHTML. Are XML documents, specs built atop the rules defined by the XML spec. This allows for any general XML parser to handle any XML-based document.

One of the biggest uses of XML is Microsoft Office when they released the new document formats that everyone was up in arms about. Office Open XML is what they call it.

As I understand it, XML is a markup language like HTML, but with a different purpose. But it can be displayed in a browser (well, some browsers) and can be styled with CSS. The main use of XML that I’m familiar with is an RSS feed, that has a basic structure like


<rss>
<channel>
	<title>Site Title</title>
	<item>
		<description></description>
	</item>
</rss>	

An RSS feed usually displays as a web page in your browser. But with something like PHP, you can easily extract information from an RSS feed for various purposes, such as displaying an item from the feed on your site.

XML is a language for defining markup languages. It is a simplification of SGML which in turn was based on the original GML. HTML between versions 2 and 4 is a markup language based on SGML.

Examples of markup languages based on XML include XHTML, RSS, and office documents created using the latest version of MS Office (although Microsoft couldn’t resist bending the XML rules slightly).

Although the official specs say that XML is a language, I find it more helpful to think of XML as defining a syntax than a language. Essentially it’s about separating markup (ie <tags> and closing </tags>) and content (everything inside the <tags>…</tags>), having well-formed and correctly nested tags that are closed in the reverse order they are opened in, and rules about special characters and character encoding. XML itself doesn’t define what the tags should be or should do, but it gives a framework that allows people to define their own language using XML rules.

As well as XHTML, RSS and some forms of office documents, another instance of XML you may have come across is SVG. This uses a completely different set of tags to XHTML and RSS, but the basic rules behind the structure of a document remain the same.

Hm, I wouldn’t say that.

Being a subset of SGML, it certainly only takes a few rules from SGML (as HTML too)… so I guess there you could say simplifying… but after that, it adds in a crapload of its own special rules, making it much more complex than SGML.

Teh Yoyo, if you’re only worried about websites, you’re likely to encounter XML doing a lot of the same stuff people use JSON for. A data-storage format/syntax.

Both SGML and XML are meta languages - they are used to define other languages such as HTML, XHTML, RSS, .doc etc.

The ipurpose of creating XML from SGML was supposed to be to provide a simpler set of rules so as to make it easier to write programs that follow them. If it is actually more complicated then it has no real reason to exist. I suspect that any ‘complexity’ is actually there to make things simpler for actually using it (not necessarily fto make it easier to write by hand).

Oh! Psshhh…yeah…psshh…JSON. Of course! Googles JSON

So from what I’ve read, XML gives a structure of how to write code, whereas HTML defines what certain tags do?

~TehYoyo

So from what I’ve read, XML gives a structure of how to write code, whereas HTML defines what certain tags do?

So far as I’m concerned, they both structure data. HTML sorta follows SGML rules (except when it doesn’t), and XML follows XML rules. JSON follows JSON rules. They just take your raw data and let you structure it so that software with a parser knows where to go if you ask it for some type of data. Tags themselves don’t actually do anything… it’s just that with HTML, browsers not only have their parser recognise those tags, they also happen to have a default CSS stylesheet to give them styles.