Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble validating pages in DW MX 1

Status
Not open for further replies.

Floodster

Technical User
Jan 28, 2005
204
Me again!!
I have validated all my pages using W3C Validator & they all passed, however I'm having problems hosting my site 'live'( . I thought I would use the Dreamweaver validate markup option & I am getting 2 errors on my template pages. They are;
Code:
Line 2: The tag name:"?xml" not found in currently active versions
Line 4: The tag:"html" is not allowed within :"?xml" it is only allowed within : .
Here are the first 4 lines of my template;
Code:
<%@ LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml"[/URL] lang="en" xml:lang="en">

As my problems hosting it live are to do with XML errors (not sure what) I think these 2 above could be the problem.
Any help would be great, It's been driving me mad all weekend & I have promised to have this up & running my the end of this week.
Thanks.
 
Not sure why you'd have the xml declaration line in there at all. It's not an xml page, it's an html page... at least according to the doctype and the html tag. Basically the page either needs to generate xml or it needs to generate html (with, I suppose, some embedded xml if desired). From all the other lines in your snippet, the xml line should simply be deleted.
 
Ok cheers,
What puzzles me is that these lines were generated by DW??
Do I delete line 2 & amend line 5 to remove the xlmns or can that stay??

Thanks for the quick reply.
 

Genimuse said:
Not sure why you'd have the xml declaration line in there at all. It's not an xml page, it's an html page.

XHTML is an XML formatted document implementing HTML semantics - the xml declaration is there because that is the standard pre-amble for xml documents.

However.. it does cause problems with the 'Standards Mode' in IE 6 - it will throw the page into Quirks Mode, even though you've declared it as XHTML.

Sounds like Dreamweaver is a little backward - Personally I would consider the W3C to be more right on this matter than Dreamweaver...



A smile is worth a thousand kind words. So smile, it's easy! :)
 
Damber,
Thanks for your comments but I'm unsure if I can take the line of code out or if I leave it in it will keep throwing up the errors??
Thanks.
 
Sorry, missed the x in the doctype. D'oh!

But I still don't get the xml line. I just generated a brand new XHTML page in Dreamweaver and here's what it created:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "[URL unfurl="true"]http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">[/URL]
<html xmlns="[URL unfurl="true"]http://www.w3.org/1999/xhtml">[/URL]
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>
<body>
</body>
</html>
No <?xml declaration.
 
It is an optional item, but is advised to be used to define the format of the file, and the version of XML in use - regardless of it being XHTML, standard xml documents should include this (which an XHTML document is).

XML Spec on Prolog (including the XML Declaration):

For example:

Code:
<?xml version="1.0" encoding="iso-12345" ?>
<!DOCTYPE something SYSTEM "formatfile.dtd" >
<rootElement>
  <childElements />
</rootElement>

uses the same principle as the XHTML format - and to ensure that XML parsers can read XML files in a standard manner, the standard elements, inluding the doctype and xml declaration as part of the prologue help it to define what the content will be like (including encoding type and xml version etc - as well as the fact that it is xml), without it, and using an alternative encoding type might cause the parser to invalidate the xml document.

You don't have to put it in there, and with XHTML it is better to leave it out due to the issues it causes with IE (which expects the doctype declaration to be the first line it reads) - but for true standards compliance and all round well-formedness of your true XML document using HTML semantics it is a good idea. Personally I don't use it due to the IE issue, although my site is fully XHTML Strict compliant.

It could be that DW excludes it for this same reason - or it could be that it just doesn't understand the need for it. That's one of the issue of using a WYSIWYG editor - they can make you think their way is the right way, and you'd never know the difference. Either way I wouldn't worry too much about it.

A smile is worth a thousand kind words. So smile, it's easy! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top