6 Replies - 783 Views - Last Post: 30 August 2012 - 06:24 AM

#1 monsterenergy22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 29-August 12

Doctype Declaration Problems

Posted 29 August 2012 - 08:50 PM

Hi everyone,

I am having trouble getting my HTML validated. I am only getting 2 errors, but whenever I try to fix them, 6 more appear. Here is the part that I am having trouble fixing.
<?xml version = "1.0" encoding = "utf-8"?>
<!DOCTYPE html public "-//w3c//DTD XHTML 1.1//EN"
   "http://www.w3.org/TR/xhtmlll/DTD/xhtmlll.dtd">

From the validator, I am getting the following errors.

Quote

Line 2, Column 16: "public" is not a reserved name
<!DOCTYPE html public "-//w3c//DTD XHTML 1.1//EN"

Line 2, Column 16: cannot continue because of previous errors
<!DOCTYPE html public "-//w3c//DTD XHTML 1.1//EN"


I have tried the various declarations from here as well with no luck.
http://www.w3schools...tag_doctype.asp

If anyone could help me fix this and get my page validated I would really appreciate it. Let me know if yall need anything else.

Is This A Good Question/Topic? 0
  • +

Replies To: Doctype Declaration Problems

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4337
  • View blog
  • Posts: 12,137
  • Joined: 18-April 07

Re: Doctype Declaration Problems

Posted 29 August 2012 - 09:12 PM

Why are you putting that XML line there? You only have that kind of header for XML files, not HTML. Your first line in an HTML file should be the <DOCTYPE> tag. XHTML is not XML... it is HTML held to the XML standard (making sure tags are closed, nested properly etc).

So delete the XML line and give it another try. :)

This post has been edited by Martyr2: 29 August 2012 - 09:13 PM

Was This Post Helpful? 1
  • +
  • -

#3 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,990
  • Joined: 08-June 10

Re: Doctype Declaration Problems

Posted 29 August 2012 - 09:16 PM

Hey.

Doctype Declarations are case-sensitive. The proper XHTML 1.1 declaration is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


Notice how the "PUBLIC" and the "W3C" in there differ from what you posted.


Also, I'd suggest this W3C page as a source for Doctype Declarations. Best to get that sort of stuff directly from the W3C, rather from questionable sites like W3Schools. (Although, granted, it looks like they got the declarations right on that page you linked to.)
Was This Post Helpful? 2
  • +
  • -

#4 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,990
  • Joined: 08-June 10

Re: Doctype Declaration Problems

Posted 29 August 2012 - 09:21 PM

View PostMartyr2, on 30 August 2012 - 04:12 AM, said:

Why are you putting that XML line there? You only have that kind of header for XML files, not HTML. Your first line in an HTML file should be the <DOCTYPE> tag.

Actually, for XHTML files served as "application/xhtml+xml", the XML declaration can be included. When that is the case you might say that the document is XML containing HTML markup, rather than HTML held up to the XML standard.
Was This Post Helpful? 3
  • +
  • -

#5 monsterenergy22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 29-August 12

Re: Doctype Declaration Problems

Posted 29 August 2012 - 10:33 PM

Thanks for the fast replies Martyr2 and Atli! Thanks again for the help.

I removed the xml line from the top and unfortunately are still receiving the validation errors.

View PostAtli, on 29 August 2012 - 09:16 PM, said:

Hey.

Doctype Declarations are case-sensitive. The proper XHTML 1.1 declaration is:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


Notice how the "PUBLIC" and the "W3C" in there differ from what you posted.


I changed to what you recommend and now I have 11 errors. Here is what it gives after the fix.

Quote

Line 72, Column 20: there is no attribute "controls"
<audio controls = "controls" autoplay = "autoplay" loop ="loop" >

Line 72, Column 42: there is no attribute "autoplay"
<audio controls = "controls" autoplay = "autoplay" loop ="loop" >

Line 72, Column 59: there is no attribute "loop"
<audio controls = "controls" autoplay = "autoplay" loop ="loop" >

Line 72, Column 66: element "audio" undefined
<audio controls = "controls" autoplay = "autoplay" loop ="loop" >

Line 73, Column 17: there is no attribute "src"
<source src = "bach.ogg" type = "audio/ogg" />

Line 73, Column 35: there is no attribute "type"
<source src = "bach.ogg" type = "audio/ogg" />

Line 73, Column 48: element "source" undefined
<source src = "bach.ogg" type = "audio/ogg" />

Line 74, Column 49: NET-enabling start-tag not immediately followed by null end-tag
<source src = "bach.mp3" type = "audio/mpeg" //>

Line 74, Column 49: element "source" undefined
<source src = "bach.mp3" type = "audio/mpeg" //>

Line 75, Column 48: NET-enabling start-tag not immediately followed by null end-tag
<source src = "bach.wav" type = "audio/wav" //>

Line 75, Column 48: element "source" undefined
<source src = "bach.wav" type = "audio/wav" //>

Was This Post Helpful? 0
  • +
  • -

#6 Atli  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 3719
  • View blog
  • Posts: 5,990
  • Joined: 08-June 10

Re: Doctype Declaration Problems

Posted 29 August 2012 - 11:10 PM

The <audio> and <source> element, as well as all the mentioned attributes, are new in HTML5. They are not valid in XHTML or HTML4.

HTML5 allows XML style markup, so if you are going to be using new elements like <audio> and <source> you may as well make like easier on yourself and just declare the page as HTML5. The Doctype for that is simply:
<!DOCTYPE html>


Was This Post Helpful? 2
  • +
  • -

#7 monsterenergy22  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 5
  • Joined: 29-August 12

Re: Doctype Declaration Problems

Posted 30 August 2012 - 06:24 AM

Wow, thank you. I never thought to look up the HTML5 doctype.

For the most part, it just brings up a bunch of obsolete methods that I can fix with CSS now.

Thanks again for your help, I really have appreciated it!
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1