473,799 Members | 3,740 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

HTML and XHTML


Hello,

What is the difference between HTML and XHTML...

Thanks,
------------------------------------------------------------------------
IT Interview Questions : http://www.geekinterview.comIT Tutorials and Articles : http://www.geekarticles.com
Oct 11 '05
32 2950
Andy Dingley wrote:

HTML must have all elements closed, just as XHTML must.


The HTML 4.01 spec shows 15 end tags that are optional, of which 4 start
tags are also optional.
http://www.w3.org/TR/html4/index/elements.html

--
Gus
Oct 13 '05 #11
In our last episode, Gus Richter <gu********@net scape.net> pronounced to
comp.infosystem s.www.authoring.html:
Andy Dingley wrote:

HTML must have all elements closed, just as XHTML must.


The HTML 4.01 spec shows 15 end tags that are optional, of which 4 start
tags are also optional.


Which is why Andy went on to clarify:
The difference is that SGML allows elements to be
closed by inference from the DTD and the appearance of some other
element that couldn't be contained inside the current element (implying
necessary closure)


IOW, all elements have to be closed in both HTML and XHTML, but HTML is
capable of closing some of them automatically, whereas XHTML has to be
specifically told to close them.

--
Mark Parnell
http://clarkecomputers.com.au
Oct 13 '05 #12
Mark Parnell wrote:
In our last episode, Gus Richter <gu********@net scape.net> pronounced to
comp.infosystem s.www.authoring.html:
Andy Dingley wrote:
HTML must have all elements closed, just as XHTML must.


The HTML 4.01 spec shows 15 end tags that are optional, of which 4 start
tags are also optional.

Which is why Andy went on to clarify:

The difference is that SGML allows elements to be
closed by inference from the DTD and the appearance of some other
element that couldn't be contained inside the current element (implying
necessary closure)

IOW, all elements have to be closed in both HTML and XHTML, but HTML is
capable of closing some of them automatically, whereas XHTML has to be
specifically told to close them.


Thank you for that, but as I understand the question, it is regarding
document creation in using HTML vs. XHTML and not how the browser is to
parse optional tags within an HTML document, or where/how am I missing
the relevance?

--
Gus
Oct 13 '05 #13
In our last episode, Gus Richter <gu********@net scape.net> pronounced to
comp.infosystem s.www.authoring.html:
Thank you for that, but as I understand the question, it is regarding
document creation in using HTML vs. XHTML and not how the browser is to
parse optional tags within an HTML document, or where/how am I missing
the relevance?


The OP simply asked what the difference between HTML and XHTML was. The
context wasn't specified. Matt's question, which Andy was responding to,
seems to me to be concerned with the way browsers handle the languages,
rather than authoring.

Either way, Andy's statement was correct, regardless of whether it
answered the question. :-)

--
Mark Parnell
http://clarkecomputers.com.au
Oct 13 '05 #14

Gus Richter wrote:
Andy Dingley wrote:

HTML must have all elements closed, just as XHTML must.


The HTML 4.01 spec shows 15 end tags that are optional, of which 4 start
tags are also optional.


Thankyou for playing straight man to the obvious question 8-)

In well-formed XML, an element is equivalent to either a pair of tags
(start and end tags) or a single tag (empty-element tag). In SGML as
used by HTML (which is slightly simplified from SGML in general) the
situation is different - there are no empty-element tags and a HTML
element can be delimited by either a pair of start and end tags (like
XML), or by a start tag and implicit closure indicated by context and
the DTD (unlike XML). For elements defined as empty (e.g. <br>) this
happens immediately after the start tag, for other elements it depends
on what follows - a <p> might be closed by the start of another <p>, or
it might even not be closed until the end of the HTML document.

However, and this is rarely grasped by HTML authors, the HTML
"elements" _are_ closed just where their XHTML equivalent would be
closed, even if there's no end tag. The "element" is an item at the
level of the DOM or the Infoset, not just a lexical item like a tag.
That's the _real_ difference between SGML tags and elements, not just a
simple "two tags make an element".

Oct 13 '05 #15
Mark Parnell said the following on 10/12/2005 08:35 +0200:
In our last episode, Cornel Bicutzi pronounced to
comp.infosystem s.www.authoring.html:
What is the difference between HTML and XHTML...


http://www.w3.org/TR/xhtml1/#diffs


I can't understand why in XHTML exclusions are not possible (chapter 4.9. of the above specified URL):

http://www.w3.org/TR/xhtml1/#h-4.9

The XHTML DTD seems to be SGML, just like the HTML DTD, is this correct? If so, then I see no reason why the XHTML DTD can't use exlusions.

The XHTML DTD seems to be excluding "a" elements by declaring an entity "a.content" which does not include "a" elements:

<!-- a elements use %Inline; excluding a -->
<!ENTITY % a.content
"(#PCDATA | %special; | %fontstyle; | %phrase; | %inline.forms; |
%misc.inline;)* ">
<!ELEMENT a %a.content;>

When I validate an xhtml document with nested <a ..> elements, it fails (it's not valid).

Maybe the XHTML DTD doesn't use exclusion like the HTML DTD does;

<!ELEMENT A - - (%inline;)* -(A) -- anchor -->

but the effect seems to be the same.

Therefor, I'm having trouble with wat is said in 4.9 SGML exclusions.

--
Regards
Harrie
Oct 13 '05 #16
Andy Dingley wrote:
Gus Richter wrote:
Andy Dingley wrote:
HTML must have all elements closed, just as XHTML must.


The HTML 4.01 spec shows 15 end tags that are optional, of which 4 start
tags are also optional.

Thankyou for playing straight man to the obvious question 8-)

In well-formed XML, an element is equivalent to either a pair of tags
(start and end tags) or a single tag (empty-element tag). In SGML as
used by HTML (which is slightly simplified from SGML in general) the
situation is different - there are no empty-element tags and a HTML
element can be delimited by either a pair of start and end tags (like
XML), or by a start tag and implicit closure indicated by context and
the DTD (unlike XML). For elements defined as empty (e.g. <br>) this
happens immediately after the start tag, for other elements it depends
on what follows - a <p> might be closed by the start of another <p>, or
it might even not be closed until the end of the HTML document.

However, and this is rarely grasped by HTML authors, the HTML
"elements" _are_ closed just where their XHTML equivalent would be
closed, even if there's no end tag. The "element" is an item at the
level of the DOM or the Infoset, not just a lexical item like a tag.
That's the _real_ difference between SGML tags and elements, not just a
simple "two tags make an element".


I'm not negating your points at all. I think that your points are well
made and are good to know. I do, however, think that in the context of
this discussion, a new author may be mislead or confused regarding the
differences between HTML and XHTML by the statement:

"HTML must have all elements closed, just as XHTML must."

The established rules for HTML clearly state that there are optional
opening/closing tags and empty elements which must not have a closing
tag. XHTML on the other hand dictates that there are no optional tags
and that all elements must be closed.

When attending a play, one goes for the performance and not for what
goes on behind the scenes, nor for the historical behind the scene
changes. Likewise, an author creates a document according to the
established rules as set out and should not have to consider behind the
scene browser parsing methods, nor historical reasons for such rules.

How it is parsed and historical linkage is good information, but not
requisite knowledge to authoring to HTML or XHTML. In the context of the
question by the OP, as I read it, I believe the statement to be
misleading and subsequent information probably only obfuscates the issue
at that level.

--
Gus
Oct 13 '05 #17
Harrie wrote:
I can't understand why in XHTML exclusions are not possible (chapter
4.9. of the above specified URL):

http://www.w3.org/TR/xhtml1/#h-4.9

The XHTML DTD seems to be SGML, just like the HTML DTD, is this correct?
It's an XML DTD. It's similar to an SGML DTD, but not quite the same.
Maybe the XHTML DTD doesn't use exclusion like the HTML DTD does;

<!ELEMENT A - - (%inline;)* -(A) -- anchor -->

but the effect seems to be the same.


Thy this in both HTML and XHTML.

<a><span><a>tes t</a></span></a>

HTML will fail validation, because the -(A) excludes the a element as
being any descendant of another a element, whereas the XHTML will pass
because the DTD only prevents child a elements.

--
Lachlan Hunt
http://lachy.id.au/
http://GetFirefox.com/ Rediscover the Web
http://GetThunderbird.com/ Reclaim your Inbox
Oct 13 '05 #18
Lachlan Hunt said the following on 10/13/2005 19:24 +0200:
Harrie wrote:
The XHTML DTD seems to be SGML, just like the HTML DTD, is this correct?
It's an XML DTD. It's similar to an SGML DTD, but not quite the same.


It doesn't begin with an xml prologue, or am I too narrow minded? Can you give me some pointers where an XML DTD is explained?
Thy this in both HTML and XHTML.

<a><span><a>tes t</a></span></a>

HTML will fail validation, because the -(A) excludes the a element as
being any descendant of another a element, whereas the XHTML will pass
because the DTD only prevents child a elements.


Hmmm, so it does, interesting. Thanks for the explanation.

--
Regards
Harrie
Oct 13 '05 #19
Harrie <sp*****@linux. org.invalid> wrote:
Lachlan Hunt said the following on 10/13/2005 19:24 +0200:
It's an XML DTD. It's similar to an SGML DTD, but not quite the
same.


It doesn't begin with an xml prologue, or am I too narrow minded?


Pardon? A DTD is *part* of the prolog -- it's an optional part of the
document type declaration which itself is an optional part of the
prolog.
Can you give me some pointers where an XML DTD is explained?


The XML spec would be a good guess, I guess.
<http://www.w3.org/TR/REC-xml/#elemdecls>
<http://www.w3.org/TR/REC-xml/#sec-entity-decl>

(note that XML markup declarations have just some restrictions compared
to SGML, so you might be able to look at an arbitrary external DTD
entity and possibly determine 'this cannot be an XML DTD', but you
cannot conclude 'this *is* an XML DTD')
--
Goodbye and keep cold
Oct 13 '05 #20

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

87
5664
by: CMAR | last post by:
For xhtml validatin, which is the right metatag to use for English language or can one forget about this tag? <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> Thanks, CMA
2
2871
by: mike | last post by:
regards: I follow the following steps to converting from HTML to XHTML http://webpageworkshop.co.uk/main/xhtml_converting My parser is http://htmlparser.sourceforge.net/ Xhtml version is 1.0 from http://nds.nokia.com/uaprof/N6600r100.xml but nokia mobile browser cannot identify the converted file(XHTML1.0). Is there something wrong with my procedure.
47
10317
by: Chuck | last post by:
Is there any logical reason why one should convert if css is already being used? What possible, immediate, benefit would there be? I am at a loss to see what, pragmatic, difference it would make.
20
2584
by: Alan Silver | last post by:
Hello, I have read about the problems that IE has when using a doctype of HTML 4.01 Transitional. I was advised to use Strict wherever possible. My question is, does the same apply to XHTML 1.0 Transitional? I develop sites using ASP.NET, which emits valid XHTML 1.0 Transitional, but not XHTML 1.0 Strict (for example, it includes a hidden form field with the name of _VIEWSTATE, which isn't valid in Strict, but is in Transitional).
9
6738
by: anupamjain | last post by:
Hi, After 2 weeks of search/hit-and-trial I finally thought to revert to the group to find solution to my problem.(something I should have done much earlier) This is the deal : On a JSP page, I want to grab a URL and parse /change the HTML and send it to the JSP page. I take the URL from the user in a textbox (not the
6
7868
by: Rolf Welskes | last post by:
Hello, if I have for example: <table style="width: 100%; height: 100%;" border="1"> <tr> <td style="width: 100px">k </td> <td style="width: 100px">k </td> </tr>
10
2977
by: git | last post by:
All, I have been working on a system to support the 'tidy' program to help convert html to xhtml. The system is a little complex for me to put together as it involves apache/php/linux and a windows daemon doing the conversion, help and email systems. I would be very grateful of anyone who would be prepared to give it a quick try and see if it works for them.
14
1869
by: Stanimir Stamenkov | last post by:
I've found some contradiction I want to resolve. <http://www.w3.org/MarkUp/2004/xhtml-faq#mime11states: I've noted "_disallowed_ text/html" and "_must_ be sent with an XML-related media type" here as strong requirement. On the other hand the current XHTML 1.1 draft <http://www.w3.org/TR/2007/WD-xhtml11-20070216/conformance.html#strict>
6
433
by: Guy Macon | last post by:
cwdjrxyz wrote: HTML 5 has solved the above probem. See the following web page: HTML 5, one vocabulary, two serializations http://www.w3.org/QA/2008/01/html5-is-html-and-xml.html
11
5132
Dormilich
by: Dormilich | last post by:
Lately I have seen so much awful HTML, that I like to show what a HTML document should look like, regarding the requirements from the W3C. the absolute minimum is defined as: or expressed in code: <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <HTML> <HEAD> <TITLE>My first HTML document</TITLE>
0
9687
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10252
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10027
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7565
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6805
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5463
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5585
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4141
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3759
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.