SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Evangelist
    Join Date
    Jun 2011
    Location
    London UK
    Posts
    495
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)

    Strange validation error

    During a validation exercise, I got a series of strange error warnings in the sense that the code actually seems right and the error warning must have another reason.


    Where do I look to solve the followring errors? What causes this kind of thing and what is the best way to avoid it?

    Code as it currently is, listed at the bottom at the end of the actual error messages.

    Sorry for the sloppy listing, I can't remember how to copy part of a screen including the formatting/lay out.

    Line 8, Column 22: an attribute specification must start with a name or name token
    <meta name=geo.region" content="UK">✉
    An attribute name (and some attribute values) must start with one of a restricted set of characters. This error usually indicates that you have failed to add a closing quotation mark on a previous attribute value (so the attribute value looks like the start of a new attribute) or have used an attribute that is not defined (usually a typo in a common attribute name).
    Line 9, Column 44: document type does not allow element "META" here
    <meta name="geo.placename" content="London">✉
    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
    Line 10, Column 46: document type does not allow element "META" here
    <META NAME="geo.position" CONTENT="5.32;-0.5"> ✉
    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
    Line 11, Column 69: document type does not allow element "META" here
    <meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE">✉
    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported error).
    Line 14, Column 7: end tag for element "HEAD" which is not open
    </head>✉
    The Validator found an end tag for the above element, but that element is not currently open. This is often caused by a leftover end tag from an element that was removed during editing, or by an implicitly closed element (if you have an error related to an element being used where it is not allowed, this is almost certainly the case). In the latter case this error will disappear as soon as you fix the original problem.

    If this error occurred in a script section of your document, you should probably read this FAQ entry.
    Line 15, Column 6: document type does not allow element "BODY" here
    <body>✉
    The element named above was found in a context where it is not allowed. This could mean that you have incorrectly nested elements -- such as a "style" element in the "body" section instead of inside "head" -- or two elements that overlap (which is not allowed).

    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects. For instance, using XHTML's "self-closing" tags for "meta" and "link" in the "head" section of a HTML document may cause the parser to infer the end of the "head" section and the beginning of the "body" section (where "link" and "meta" are not allowed; hence the reported



    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>Powerflush south east London boiler repair central heating west Kent power flush</title>
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8">
    <meta name="Description" content="Powerflush central heating boiler repair south east London west Kent power flush">
    <meta name="Keywords" content="powerflush, power flush, south London boiler repairs, central heating, powerflushing">
    <meta name=geo.region" content="UK">
    <meta name="geo.placename" content="London">
    <META NAME="geo.position" CONTENT="5.32;-0.5">
    <meta name="SKYPE_TOOLBAR" content="SKYPE_TOOLBAR_PARSER_COMPATIBLE">
    <!-- Place this tag in your head or just before your close body tag -->
    <script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
    </head>
    <body>

  2. #2
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    You'll notice one of the warnings that crept up to bite you were as follows:

    Quote Originally Posted by W3C Validator
    One common cause for this error is the use of XHTML syntax in HTML documents. Due to HTML's rules of implicitly closed elements, this error can create cascading effects.
    You can get cascading error reports where there are no errors (false positives) if you don't sort out the errors higher up the page...

    I'd need a link to the FULL page (or code) in question to see what else actually is going on...

    But for starters on this line: <meta name=geo.region" content="UK"> you are missing a quote; should read:
    <meta name="geo.region" content="UK">

    Fix that and the rest of the sample you posed in [post #1] will work 100%.

    However, I believe you had more code? Because there were rather a lot of errors and warnings being output - even if they were just only "cascading errors".

    How do you become better prepared for these errors you ask? You arm yourself with a Lint not just a Validator. If you are using Firefox I would recommend: Html Validator for Firefox and Mozilla since it also can be set to run Tidy (a Lint). Albeit I would not use the 'Cleanup...' feature of that Addon. Plus would still check the official W3C Validator later after for "Peace of Mind" but it might just help you [Lint] with spotting where the errors begin more easily.

    Plus become familiar with the comment delimiters <!-- They are your best friend --> when debugging markup to comment out suspect items, to narrow down where the errors are really occurring, etc.

  3. #3
    SitePoint Evangelist
    Join Date
    Jun 2011
    Location
    London UK
    Posts
    495
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    That did the job, many thanks. Still had to look four times before I spotted the missing quote; so hard to correct your own typos, especially when you are my beginner's level.
    I'll take your other advice on board as well.

  4. #4
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    No worries and the Tidy Lint should make it easier at spotting potential errors and you should nearly always start fixing near the top of the page. Also is one of those things that you getter better at with practice.

    Plus once you realise errors from the Validator don't always correspond to where the error first occurs and can sometimes be a "cascading error" it gets slightly more comforting. When those let's say; 6 potential errors was only 1 really.

    It mainly takes practice really and if you get more used to what some of the cryptic validator errors mean it becomes smoother.

  5. #5
    SitePoint Evangelist
    Join Date
    Jun 2011
    Location
    London UK
    Posts
    495
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by xhtmlcoder View Post
    No worries and the Tidy Lint should make it easier at spotting potential errors....
    Erh? Tidy Lint? Whossat?

  6. #6
    Robert Wellock silver trophybronze trophy xhtmlcoder's Avatar
    Join Date
    Apr 2002
    Location
    A Maze of Twisty Little Passages
    Posts
    6,316
    Mentioned
    60 Post(s)
    Tagged
    0 Thread(s)
    It's the W3C based HTML-Tidy Lint Checker http://en.wikipedia.org/wiki/HTML_Tidy that appears within that addon I mentioned (within the link above [post #2]) that Firefox addon makes it far easier to use as its inbuilt and has a nice GUI.

    Also http://validator.w3.org/ offers online "Clean up Markup with HTML-Tidy" under the 'More Options' checkbox heading on the validator itself.

    But the Lint is not perfect and can sometimes - but rarely - accidentally alter things... But that tends to be more if you have a lot of scripting within markup that can sometimes confuse it when trying to "fix" some errors.

  7. #7
    SitePoint Evangelist
    Join Date
    Jun 2011
    Location
    London UK
    Posts
    495
    Mentioned
    5 Post(s)
    Tagged
    0 Thread(s)
    Ah, magic, many thanks. I will try that out today.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •