[RESOLVED] Validation doesn't like <img ... />

windows

Guest
i am getting this error:<br />
<br />
<!-- m --><a class="postlink" href="http://validator.w3.org/images/info_icons/error.png">http://validator.w3.org/images/info_icons/error.png</a><!-- m --> Line 27, Column 117: character data is not allowed here.?cart/Results.cfm?category=9" alt=""/><br />
<br />
that full line is:<br />
<img src=http://www.webdeveloper.com/forum/archive/index.php/"cw3/Assets/cart_images/base_page.jpg" alt="Welcom to Lonepine Prairie Pillows!" /><br />
<br />
<br />
any ideas?<br />
<br />
thanks<!--content-->Got a link we can check?<!--content-->http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Flonepineprairiepillows.com%2Fcart%2FResults.cfm%3Fcategory%3D7<!--content-->oh no, if that link wasn't any good, try: <br />
<!-- m --><a class="postlink" href="http://lonepineprairiepillows.com/cart/Results.cfm?category=9">http://lonepineprairiepillows.com/cart/ ... category=9</a><!-- m --><br />
and validate<!--content-->The problem is due to using a XHTML-style empty tag within a HTML 4 document. The validator is a bit quirky on how it reacts to this sort of thing. This page (<!-- m --><a class="postlink" href="http://www.cs.tut.fi/~jkorpela/html/empty.html">http://www.cs.tut.fi/~jkorpela/html/empty.html</a><!-- m -->) gives a complete description of the problem, and the basic summary is:<br />
<br />
If you start using XHTML features like <hr />, don't expect your documents to validate against an HTML DOCTYPE. They need to be converted to comply with XHTML requirements as a whole, including the use of an XHTML DOCTYPE.<!--content-->i'm sorry, that all seems very confusing to me. should i change the doctype? i didn't really get a solution from that document, though it seems very informative!<!--content-->i'm sorry, that all seems very confusing to me. should i change the doctype? i didn't really get a solution from that document, though it seems very informative!<br />
<br />
Make up your mind. If you intend to use an XHTML doctype, then use an XHTML notation (<img ... />), if you intend to use an HTML doctype, then use a HTML notation (<img ...>). <br />
<br />
Use the proper notation for the chosen doctype.<!--content-->isn't there a transitional doctype that will allow..both? <br />
if no, i'd like to use the <img... /> and i guess i'm unsure of what the doctype line should read?<!--content-->The use of a "/" at the end of a tag, such as "<br />" or "<img src='http://www.webdeveloper.com/forum/archive/index.php/pic' />" is a feature of XHTML and is non-standard (though most browsers support it OK) when used in a HTML document. Since your document has a HTML doctype declaration, using the "/>" on empty tags (tags that do not have separate closing tags) is not truly valid.<br />
<br />
To ensure that the document will validate, you have two choices: (1) remove all of the "/" at the end of empty tags (use "<br>" or "<img src='http://www.webdeveloper.com/forum/archive/index.php/pic'>"), or (2) change your doctype declaration to an applicable XHTML doctype and then make sure everything conforms to that standard.<br />
<br />
In my opinion, unless you are using some special XML-related feature available in XHTML that is not available in HTML, I would stick with HTML and get rid of the slashes. (I would also use a Strict doctype instead of Transitional, unless you have a specific reason for using it.)<!--content-->XHTML doctypes (from <!-- m --><a class="postlink" href="http://www.w3.org/QA/2002/04/valid-dtd-list.html">http://www.w3.org/QA/2002/04/valid-dtd-list.html</a><!-- m -->):<br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><br />
<br />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"<br />
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"><!--content-->thanks for that information, it proves valuble. but when i change the DOCTYPE to strict, all of my align="" and things like that come up as errors and it seems to cause more problems than solve. thoughts?<!--content-->isn't there a transitional doctype that will allow..both? <br />
if no, i'd like to use the <img... /> and i guess i'm unsure of what the doctype line should read?<br />
It is not a matter of what you would like, it is up to what you need. Unless you intend to use/request XML documents in your page, there is of no use to have an XHTML code, so that I would suggest you to consider the NogDog's recommendation for an HTML doctype (strict or transitional).<!--content-->yeah, i was a little unclear on the reasoning, but i just removed the "/"s and it validated, so i left the DOCTYPE at transitional and just went with that solution. thanks a lot.<!--content-->thanks for that information, it proves valuble. but when i change the DOCTYPE to strict, all of my align="" and things like that come up as errors and it seems to cause more problems than solve. thoughts?<br />
Use a transitional HTML doctype. In HTML strict, you should use mainly CSS for presentation, not HTML attributes. Keep in mind that the modern approach is for a separation content/presentation, thus you should learn to use CSS.<!--content-->i've got a decent understanding of CSS and use it consistently. thankyou.<!--content-->
 
Top