473,396 Members | 2,037 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

img inside pre


It seems to be invalid in HTML 4.01, but valid in XHTML 1.0. Why is there the difference? Can that pose a problem when such a XHTML document is served as text/html?
Sep 17 '05 #1
8 3758
"Jarno Suni" no*@here.invalid wrote:

[img inside pre]
It seems to be invalid in HTML 4.01, but valid in XHTML 1.0.


It's invalid under both.

--
Spartanicus
Sep 17 '05 #2
"Jarno Suni" no*@here.invalid wrote:
It seems to be invalid in HTML 4.01, but valid in XHTML 1.0.


I created two test documents and compared. It (assuming you mean <pre>
elements containing <img> elements[1]) is invalid in both HTML 4.01 Strict
and XHTML 1.0 Strict.

[1] Please contain your whole message in the body text

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Sep 17 '05 #3
I created two test documents and compared. It (assuming you mean <pre>
elements containing <img> elements[1]) is invalid in both HTML 4.01 Strict
and XHTML 1.0 Strict.
I believe you. But
<pre><a><img src="image.png" alt="" /></a></pre>
validates as XHTML 1.0 Strict whereas
<pre><a><img src="image.png" alt=""></a></pre>
does not validate as HTML 4.01 Strict, when I used http://validator.w3.org/ for validation.
[1] Please contain your whole message in the body text


Ok, if it helps. Sorry for not being precise in my original message.
Sep 18 '05 #4
In article <5k**************@read3.inet.fi>,
"Jarno Suni" no*@here.invalid wrote:
I created two test documents and compared. It (assuming you mean <pre>
elements containing <img> elements[1]) is invalid in both HTML 4.01 Strict
and XHTML 1.0 Strict.


I believe you. But
<pre><a><img src="image.png" alt="" /></a></pre>
validates as XHTML 1.0 Strict whereas
<pre><a><img src="image.png" alt=""></a></pre>
does not validate as HTML 4.01 Strict, when I used http://validator.w3.org/
for validation.


XML DTDs are more limited in their expressiveness. The inability to
express exclusions like that is one of the limitations.

--
Henri Sivonen
hs******@iki.fi
http://hsivonen.iki.fi/
Mozilla Web Author FAQ: http://mozilla.org/docs/web-developer/faq.html
Sep 18 '05 #5
Henri Sivonen <hs******@iki.fi> wrote:
<pre><a><img src="image.png" alt="" /></a></pre>
validates as XHTML 1.0 Strict whereas
<pre><a><img src="image.png" alt=""></a></pre>
does not validate as HTML 4.01 Strict, when I used
http://validator.w3.org/ for validation.


XML DTDs are more limited in their expressiveness. The inability to
express exclusions like that is one of the limitations.


The XHTML 1.0 DTD tries to overcome the limitation by using a special
content model for the <pre> element:

<!-- pre uses %Inline excluding big, small, sup or sup -->

<!ENTITY % pre.content
"(#PCDATA | a | %fontstyle; | %phrase; | %special.pre; | %misc.inline;
| %inline.forms;)*">

This won't make <pre><a><img src="image.png" alt=""></a></pre> invalid,
though, since the rules are satisfied: <pre> contains just the <a> element,
which is allowed of course, and the content model of <a> allows any inline
content, including <img>.

It would be possible, but highly impractical, to write XML syntax rules in
a manner that corresponds to the HTML rules for <pre>. You would
essentially have to duplicate a large number of syntax rules, having both
"general version" and "pre version". Besides, the whole point in those
<pre> rules is questionable. The intent is to disallow markup that might
cause font size to change or might introduce anything that is not
representable as a "character cell". Yet, allowing e.g. form fields inside
<pre> works against this idea, and sounds rather pointless.

--
Yucca, http://www.cs.tut.fi/~jkorpela/
Pages about Web authoring: http://www.cs.tut.fi/~jkorpela/www.html

Sep 18 '05 #6
In article <5k**************@read3.inet.fi>,
"Jarno Suni" no*@here.invalid wrote:

<pre><a><img src="image.png" alt="" /></a></pre>
validates as XHTML 1.0 Strict whereas
<pre><a><img src="image.png" alt=""></a></pre>
does not validate as HTML 4.01 Strict, when I used http://validator.w3.org/
for validation.


XML DTDs are more limited in their expressiveness. The inability to
express exclusions like that is one of the limitations.


Do you mean I should avoid using the XHTML code even if it validates?
Can I trust that the XHTML is displayed the same way when served as application/xhtml+xml and text/html?
Sep 18 '05 #7
"Jarno Suni" no*@here.invalid wrote:
I believe you. But
<pre><a><img src="image.png" alt="" /></a></pre>
validates as XHTML 1.0 Strict


Valid, but non-conformant:
http://www.w3.org/TR/xhtml1/#h-4.9
http://www.w3.org/TR/xhtml1/#prohibitions

--
David Dorward <http://blog.dorward.me.uk/> <http://dorward.me.uk/>
Home is where the ~/.bashrc is
Sep 18 '05 #8
"Jarno Suni" no*@here.invalid wrote:
I believe you. But
<pre><a><img src="image.png" alt="" /></a></pre>
validates as XHTML 1.0 Strict


Valid, but non-conformant:
http://www.w3.org/TR/xhtml1/#h-4.9
http://www.w3.org/TR/xhtml1/#prohibitions


Thanks, this clarifies the dilemma and gives me the reason to use different code.
Sep 18 '05 #9

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

Similar topics

0
by: Nick Coghlan | last post by:
Anyone playing with the CPython interpreter's new command line switch might have noticed that it only works with top-level modules (i.e. scripts that are directly on sys.path). If the script is...
15
by: Nick Coghlan | last post by:
Python 2.4's -m command line switch only works for modules directly on sys.path. Trying to use it with modules inside packages will fail with a "Module not found" error. This PEP aims to fix that...
9
by: sathya | last post by:
I was going through an Boyer-Moore-Horspool pattern match, I saw a array inside a array, like the below, skip ] = patlen - i - 1; The array is decleared as int skip; unsigned char *pat;
0
by: Severino | last post by:
Hi all, we have developed a .NET component for use inside Windows Forms: this component has been written using VC++.NET (2003) and is working perfectly when inserted inside VC#.NET or VB.NET...
0
by: Severino | last post by:
Hi all, we have developed a .NET component for use inside Windows Forms: this component has been written using VC++.NET (2003) and is working perfectly when inserted inside VC#.NET or VB.NET...
0
by: Les Caudle | last post by:
I have a menu system composed of a DataList nested inside a DataList. The outer DataList has it's DataSource (composed of a DataSet with two tables linked by a CategoryPagesRelation Relation) set...
1
by: Matik | last post by:
Hi to all, Probably I'm just doing something stupid, but I would like you to tell me that (if it is so), and point the solution. There ist the thing: I' having a sp, where I call other sp...
4
by: Rares Vernica | last post by:
Hi, How can I save a reference inside a container? For example I have: map<string, unsignedX; I would like to be able to save a reference to a position inside X. For a vector, the...
5
by: Test | last post by:
Is it possibel to have DIV's inside a table cell so that their position can be given relative to top left corner of the cell. Now the DIVs seem to position themselves relative to previous object.
14
by: raylopez99 | last post by:
KeyDown won't work KeyPress fails KeyDown not seen inspired by a poster here:http://tinyurl.com/62d97l I found some interesting stuff, which I reproduce below for newbies like me. The main...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
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...

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.