This topic is now archived and is closed to further replies.


Html vs. Xml

Recommended Posts

I have been programming for about two years. I know C, C++, Visual Basic, DirectX and OpenGL. A couple of days ago I started learning Html. This has to be one of the easyiest languges I have ever learned. All you have to know to make a good website, is know a bunch of tags. Well my question is whats the difference between Html and Xml? Which one is better? And which one is easier to learn?

Share this post

Link to post
Share on other sites
i did a search for ''xml'' on google, clicked on the first link in the results list, clicked on a link ''what is xml?'' and got this

i''m sure you could''ve done that yourself too

Share this post

Link to post
Share on other sites

XML is like HTML in syntax, only its used for storing information rather than displaying it.

This is only actually true to a certain extent. The rules of XML are in fact a lot more strict than the rules of HTML. For instance, all attributes in XML *must* be enclosed in ""'s, so while the following is legal HTML:
      <td width=400>    
it is *not* legal in XML, but would have to be
<td width="400">

Also, in XML all tags must be closed ( so no <br> without a </br> ), and has to be closed in reverse order of opening.
In addition XML has support for both internal and external datatype-definitions (using the rather poor DTD-format for the moment, but probably changing to an XML-compliant format in the near future).


- Death awaits you all with nasty, big, pointy teeth. -

Edited by - Neophyte on June 7, 2001 7:56:38 PM

Share this post

Link to post
Share on other sites
HTML is a text mark-up language, it''s used to do all the nifty color, font, and positioning stuff you need to layout content.

XML is pure content. You define a heirarchy against the content, but not any layout. XSL can work against an XML file, but it is very limited (grrrrr..).

On the surface HTML is very easy. But if you try to code for multiple browsers, you will have a rough time. If one browser you want to work on is Netscape, I recommend developing on that first, then getting it to work on the other browsers. The problem is there are gaping holes in the HTML standard, so different browsers default differently. Have fun!

One hint: if you use the table tag, set the width, cellpadding, cellspacing, and border properties every time.

Share this post

Link to post
Share on other sites
XML is not really a language, it is a meta-language - a language to build another language. It provides the means to adhere to a specific set of rules through the use of DTDs or Schemas.

For convenience most people just say, "yeah I use the XML protocol." More correctly, "yeah I use an application of XML". XML allows you to define your own tags and rules governing their use. XML is a subset of SGML, Standard Generalized Markup Language (a monstrous hard to follow markup meta-language language) which makes using it very easy.

The big difference between XML and HTML is that HTML is typically used for formatting, layout, and presentation. XML is used to define the data and is not concerned about its graphical representation (that is what you use XSL/XSLT).

A standard that many people are working on is an XML application/conversion of HTML, called "XHTML". XHTML is much more strict than HTML (all tags MUST be closed, even the <p>/paragraph tag etc). If you want to learn the best of both worlds (learning XML and HTML) start picking up XML. It has many more uses than HTML. Using XHTML you can still design websites and whatnot. If you learn XHTML you''ll find HTML a breeze.

You''ll find many interesting applications of XML. From Microsoft''s SOAP (Simple Object Access Protocol) to WML (Wireless Markup Language), MathXML etc.

Here are some references books on XML and XHTML:

Inside XML , Steven Holzner, ISBN:0-7357-1020-1 ($74.95 CAN)
An absolutely awesome and indepth view of XML, XSL, XLink, XPointer and generally anything XML (DTDs, Schemas, namespaces, SAX/parsing XML). Samples of using XML parsers are written in Java.

XML For the World-Wide Web , Elizabeth Castro, ISBN 0-201-71098-6 ($29.95)
This book will get you started in XML very quickly. Elizabeth Castro has an awesome and concise way of explaining things. While the above book goes into more detail (and is much longer winded), this book is straight to the point. You could probably read it in a few days. The price is also right

HTML & XHTML: The Definitive Guide 4th Edition , Chuck Musciano & Bill Kennedy, ISBN: 0-596-00026-X ($51.95 CAN)
Provides an indepth guide to writting HTML 4.0 and XHTML 1.0 and shows you the differences between the two. Great HTML/XHTML reference.

Whew! What a mouth full. If anything, at least buy, "XML For the World-Wide Web". It will get you started very quickly with XML since it is a very easy book to read. It might not give you the ultimate indepth details (like Inside XML) but you also won''t fall asleep reading it

Best regards (and I hope this helps),

Dire Wolf

Share this post

Link to post
Share on other sites