View Full Version : W3C Validation says: Elements are undefined


verydeepwater
01-09-2013, 05:50 AM
I am making a fixed layout eBook in xhtml, using Dreamweaver. I am trying to mark out a section using html5 tags: <article> and <section>. Everything looks OK, but when I validate it, I get the error message: element "article" undefined [XHTML 1.1]
Is it possible to use these elements with XHTML?
Is there a way to avoid these error messages?
Is it OK to ignore these error messages for ePubs?

mzmm
01-09-2013, 07:26 AM
if you're trying to validate HTML5 as XHTML 1.1 then it's not going to work.

what you've created is an XHTML5 document (XML + HTML5), and because you likely don't have a <!DOCTYPE html> in the document, W3C is going to guess that it's XHTML 1.1/1.0 because of the <?xml ...> declaration, and throw errors when it encounters HTML5 elements.

W3C validator doesn't auto-detect or allow you to select XHTML5 to validate against, so a way around this is to set the Doctype to HTML5 (Experimental) from the dropdown menu and run it that way, although this will only let you know that you've created a valid (or invalid) HTML5 document. however, if you're using anything related to the epub namespace (ie, <a epub:type="noteref" ...>) it's still not going to pass W3C.

what's more important, i think, is running it through epubcheck to verify that it's a valid epub, since that validator is going to be tailored to the epub specs.

still figuring all this out myself, so if anyone cares to correct me it's appreciated

verydeepwater
01-09-2013, 09:49 AM
Thanks very much for the reply, it was on the lines I was beginning to suspect. Do you think then, one could ignore these errors which appear with W3C validation, as long as the file passes epubcheck?

verydeepwater
01-09-2013, 09:57 AM
I have tried changing the setting to HTML5 experimental in Dreamweaver as you suggested and I still get the error message: the elements article and section are undefined.

I couldn't understand what you meant by:

<a epub:type="noteref" ...>) it's still not going to pass W3C.

JSWolf
01-09-2013, 08:18 PM
The solution is to remove all HTML5 code as it's not valid ePub code unless you are making ePub 3.

mzmm
01-10-2013, 07:30 AM
The solution is to remove all HTML5 code as it's not valid ePub code unless you are making ePub 3.

this is an excellent solution. i might've assumed incorrectly that OP's making an epub3 because it's fixed layout.

I couldn't understand what you meant by:

<a epub:type="noteref" ...>) it's still not going to pass W3C.

epub:type is an epub3 attribute. my point was only that W3C will invalidate if it encounters it.

I have tried changing the setting to HTML5 experimental in Dreamweaver as you suggested and I still get the error message: the elements article and section are undefined.

is there a 'HTML5 experimental' setting in DW? i meant to try with W3C's online validator and try the setting there. if it's telling you that <article> and <section> are undefined then it's not recognizing your document as HTML5.

verydeepwater
01-11-2013, 05:03 AM
you asked: is there a 'HTML5 experimental' setting in DW?

There is but still WC3 validation refuses to accept HTML 5 tags. can I ask about epub3. Is that widely accepted on devices now? Is there somewhere I can learn how to make an epub 3 document?

JSWolf
01-11-2013, 05:09 AM
ePub 3 is not accepted. Might never be unless the get rid of the multimedia junk.