• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

XML, HTML, what's the difference?

 
village idiot
Posts: 1208
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm doin' the cattle drive, and I am currently workin' on Servlets, which generate web pages using HTML. I have a RUDIMENTARY grasp of HTML, and I am assuming that XML is similar. How are they different, and where can I find a good source of info on XML?
 
Ranch Hand
Posts: 40
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi buddy,
For my suggestion, pls go to http://www.w3schools.com/.
Good Luck.
 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
This url is a best suggestion for begginers of XML.
Thanks
Shanthi
 
Greenhorn
Posts: 11
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, http://www.w3schools.com/ is a good place for beginners.
 
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

I have a RUDIMENTARY grasp of HTML, and I am assuming that XML is similar. How are they different, and where can I find a good source of info on XML?


The link above is a good one, but I'll try to do a brief explanation of how the two are similar and different.
First of all, XML looks a lot like HTML. You use tags which can have multiple attributes. The basic difference is the meaning of the tags. In HTML, the tags give extra information about how data should be displayed. In XML, the tags give extra information about what the data represents.
For example, you might have a block of code that looks like this in HTML:

And you might have a block of code that looks like this in XML:

Notice that the tags in the HTML code block say how the text should be displayed - the first line should be displayed in bold and the second line should be displayed in italics. There is nothing there, however, that let's you know what the data really represents.
In the XML block, you can easily see that the data represents a first and last name pair (in this case, mine). However, there is no information about how to display the data - that's left out in XML. In XML, the markup is there in order to describe what the data is, not how to display it.
One other key feature is that, unlike in HTML, you can create create your own tags in XML. If you're working on an address book, you might find a "CITY" tag useful. If you're working on a astronomical catalog, you might find a "STAR" tag useful. You can use whatever tags you need in order to accomplish the task at hand, because each tag really just explains what the encapsulated text means.
Now, this is a very brief overview of the differences between HTML and XML. There are many more differences and similarities. I'm just hoping this will help you understand the purpose of XML.
Corey
 
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Differences between HTML and XML include:
All tags in XML must be closed, either by a matching, closing tag:
<B>Hello</B>
Or by a self-closing tag:
<BR/>
Singleton, or atomic tags, which are allowed in HTML (like <P> are not allowed in XML.
Also, elements cannot overlap in XML. In HTML the following would be perfectly acceptable:
<b><i>Hello</b></i>
Where the closing tags are not precisely in the reverse order of the openeing tags, but in XML this would not be allowed. You must do this:
<b><i>Hello</i></b>
You may have also noticed that attribute values in HTML may be in quotes, but that this is not necessary. In XML, attribute values must ALWAYS be in quotes.
There is a new version of HTML coming out, which conforms to all the rules of XML, and therefore "is" XML as well at being a specific langugage for web pages. It's called XHTML, and you can find a nice tutorial at:
http://www.wdvl.com/Authoring/Languages/XML/XHTML/
(I also agree with those who've recommended the w3schools site. Very nicely done).
-Scott Bain-
www.netobjectives.com
 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
They are very much different semantically rather than the syntax.
While HTML is represent presentation on the browser, XML is more of a document exchange format that adds meaning to content rather than just represent a view.
The essentials at www.xml.com are good.
The book "Inside XML" is very good too.
 
Carol Murphy
village idiot
Posts: 1208
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks guys! Your posts have been a great help.
See ya around the ranch!
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here I come learning to you people and sites now, you suggested. thanks,
Raju
 
Ranch Hand
Posts: 445
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Always use the HTML Tidy to clean up your html pages. Also in this page Raggett explains the diference between HTML and XML (here refer to XHTML) very clearly.

Doug
 
Ranch Hand
Posts: 2166
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The shortest explanation I read until now is:
In HTML <table> is possible, but <chair> not.
In XML both is possible.
 
Corey McGlone
Ranch Hand
Posts: 3271
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Axel Janssen:
The shortest explanation I read until now is:
In HTML <table> is possible, but <chair> not.
In XML both is possible.


Don't get the tags in the two languages mixed up. In HTML, all tags refer to display properties. In XML, all tags refer to data properties.
For example, in HTML, the table tag refers to a graphical representation of a table, or grid on the page. In XML, a chair tag most likely refers to a real, physical chair. Within that chair tag, you'd probably find attributes such as height, number of legs, etc. These attributes describe the chair. The HTML table has nothing to do with a real life table that you might eat a meal at.
Notice that, when talking about the HTML table tag, I can say definitively what it is. That's because the table tag (like all HTML tags) is predefined. In XML, however, you can use whatever tags that best fit your data model. If you're describing furniture, you might have a chair tag or a table tag. If you're describing a person, you might have a name tag or a social security number tag. That's why, when I talk about the chair tag, I say that it will "probably" contain this or "might" contain that. I can create a chair tag that is entirely different from someone else's chair tag in XML. In HTML, however, everyone's table tags will be the same (have the same attributes, anyway).
The real key to the difference between XML and HTML isn't that you can have different tags, but it's the difference in the meaning of the tags. In HTML, markup describes how the enclosed data should be displayed. In XML, the markup explains what the data is, not how it should be displayed.
Corey
 
Scott Bain
Ranch Hand
Posts: 46
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Another way to state the distinction:
HTML is a language. It has semantics and grammar, and a specific purpose (presentation)
XML is a meta-language. You can define other languages in it, by creating specific semantics and grammar (often expressed in a DTD or Schema). One such language is XHTML, another is XSLT, another is XML-Schema. All languages written in XML must conform to the rules of well-formedness (which traditional HTML does not).
-S-
 
So you made a portal in time and started grabbing people. This tiny ad thinks that's rude:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic