Loading ...
Sorry, an error occurred while loading the content.
 

Re: [NH] Using for the opening and closing tags with xhtml

Expand Messages
  • loro
    ... Leave them. ... Yes. In XHTML HTML and BODY are required. In HTML they are optional. Actually TITLE is the only required element in HTML. You write HTML so
    Message 1 of 9 , Oct 1, 2006
      Mike Breiding - Morgantown WV wrote:
      >So, would you leave or remove the <html> </html> tags in an xhtml document?

      Leave them.

      >Does it matter?

      Yes. In XHTML HTML and BODY are required. In HTML they are optional.
      Actually TITLE is the only required element in HTML. You write HTML so you
      need them. Find out what in the original document makes it not validate.
      Something must be different from the code you posted. Or you didn't use a
      validator but a lint of some kind and it nags about something irrelevant
      for validity. Did you use a validator? What was the error?

      Lotta
    • Mike Breiding - Morgantown WV
      ... ======================================= ...
      Message 2 of 9 , Oct 1, 2006
        At 08:48 AM 10/1/2006 , you wrote:

        >Mike Breiding - Morgantown WV wrote:
        > >So, would you leave or remove the <html> </html> tags in an xhtml document?
        >
        >Leave them.
        >
        > >Does it matter?
        >
        >Yes. In XHTML HTML and BODY are required. In HTML they are optional.
        >Actually TITLE is the only required element in HTML. You write HTML so you
        >need them. Find out what in the original document makes it not validate.
        >Something must be different from the code you posted. Or you didn't use a
        >validator but a lint of some kind and it nags about something irrelevant
        >for validity. Did you use a validator? What was the error?
        >
        >Lotta

        =======================================
        I used http://validator.w3.org/ to Validate this:
        ---
        <html>
        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
        Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html
        xmlns="http://www.w3.org/1999/xhtml">

        <head>
        <meta name="DESCRIPTION" content="" />
        <meta name="keywords" content="" />
        <meta http-equiv="content-type" content="text/html; charset=us-ascii" />

        <title>TITLE GOES HERE</title>
        <link rel="stylesheet" href="sampler.css" type="text/css" />
        <!--[if IE]><style type="text/css">html .wrapper, html .columns-float,html
        .menu, html .content,html h2 {p\osition: relative;}</style>
        <![endif]-->
        </head>
        <body>
        <div id="wrapper">
        <div id="header">
        <h1>**H1**</h1>
        <h2>**H2**</h2>
        <h3>**H3**</h3>
        </div>

        <div id="gallery">
        <div id="content">
        <img src="portrait_mike_breiding.jpg" width="237" height="300" title=""
        alt="" /><p>portrait_mike_breiding.jpg (237x300; 44552 bytes)</p>
        </div>
        </div>

        <div id="footer">
        Photos and text © <a
        href="mailto:%6d%69%6b%65%40%6d%62%72%65%69%64%69%6e%67%2e%75%73">Mike
        Breiding</a> October 01, 2006 -- 9:25:27 AM
        </div></div></body>
        </html>
        ----

        This was the error report generated:


        Result: Failed validation, 8 errors
        File: upload://Form Submission
        Encoding: utf-8
        Doctype: (no Doctype found)
        Root Namespace: http://www.w3.org/1999/xhtml

        No DOCTYPE found! Attempting validation with HTML 4.01 Transitional.

        The DOCTYPE Declaration was not recognized or is missing. This
        probably means that the Formal Public Identifier contains a spelling error,
        or that the Declaration is not using correct syntax. Validation has been
        performed using a default "fallback" Document Type Definition that closely
        resembles "HTML 4.01 Transitional", but the document will not be Valid
        until you have corrected this problem with the DOCTYPE Declaration.

        Learn how to add a doctype to your document from our FAQ.
        Namespace Found in non-XML Document

        Namespace "" found, but document type is not XML!

        This page is not Valid (no Doctype found)!

        Below are the results of attempting to parse this document with an SGML parser.

        1. Error Line 1 column 0: no document type declaration; implying
        "<!DOCTYPE HTML SYSTEM>".

        <html>

        The checked page did not contain a document type ("DOCTYPE")
        declaration. The Validator has tried to validate with a fallback DTD, but
        this is quite likely to be incorrect and will generate a large number of
        incorrect error messages. It is highly recommended that you insert the
        proper DOCTYPE declaration in your document -- instructions for doing this
        are given above -- and it is necessary to have this declaration before the
        page can be declared to be valid.

        ?
        2. Error Line 2 column 2: "DOCTYPE" declaration not allowed in instance.

        <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
        Strict//EN" "http://www.w3.org/T

        ?
        3. Error Line 2 column 124: there is no attribute "XMLNS".

        ...1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml">

        You have used the attribute named above in your document, but the
        document type you are using does not support that attribute for this
        element. This error is often caused by incorrect use of the "Strict"
        document type with a document that uses frames (e.g. you must use the
        "Transitional" document type to get the "target" attribute), or by using
        vendor proprietary extensions such as "marginheight" (this is usually fixed
        by using CSS to achieve the desired effect instead).

        This error may also result if the element itself is not supported in
        the document type you are using, as an undefined element will have no
        supported attributes; in this case, see the element-undefined error message
        for further information.

        How to fix: check the spelling and case of the element and
        attribute, (Remember XHTML is all lower-case) and/or check that they are
        both allowed in the chosen document type, and/or use CSS instead of this
        attribute.

        ?
        4. Error Line 2 column 154: document type does not allow element "HTML"
        here.

        ... xmlns="http://www.w3.org/1999/xhtml">

        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).

        ?
        5. Error Line 5 column 65: character data is not allowed here.

        ...ESCRIPTION" content="content secription goes here" />

        You have used character data somewhere it is not permitted to
        appear. Mistakes that can cause this error include putting text directly in
        the body of the document without wrapping it in a container element (such
        as a <p>aragraph</p>) or forgetting to quote an attribute value (where
        characters such as "%" and "/" are common, but cannot appear without
        surrounding quotes).

        ?
        6. Error Line 13 column 6: 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 occured in a script section of your document, you
        should probably read this FAQ entry.

        ?
        7. Error Line 14 column 5: document type does not allow element "BODY"
        here.

        <body>

        ?
        8. Error Line 31 column 7: "HTML" not finished but document ended.

        </html>



        ----------
        Check it out:
        www.EpicRoadTrips.us

        [Non-text portions of this message have been removed]
      • loro
        ... OK, but this isn t the code you posted earlier. In this version you have an extra BEFORE the doctype. Lotta
        Message 3 of 9 , Oct 1, 2006
          Mike Breiding - Morgantown WV wrote:
          >I used http://validator.w3.org/ to Validate this:
          >---
          ><html>
          ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
          >Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html
          >xmlns="http://www.w3.org/1999/xhtml">

          OK, but this isn't the code you posted earlier. In this version you have an
          extra <html> BEFORE the doctype.

          Lotta
        • loro
          ... OK, I think I get what you are after now. All XHTML elements must be nested within the root element . The doctype isn t an element. It should
          Message 4 of 9 , Oct 1, 2006
            loro wrote:
            >Mike Breiding - Morgantown WV wrote:
            > >I used http://validator.w3.org/ to Validate this:
            > >---
            > ><html>
            > ><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0
            > >Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html
            > >xmlns="http://www.w3.org/1999/xhtml">
            >
            >OK, but this isn't the code you posted earlier. In this version you have an
            >extra <html> BEFORE the doctype.

            OK, I think I get what you are after now. "All XHTML elements must be
            nested within the <html> root element". The doctype isn't an element. It
            should always be the very first thing. Except in XHTML it should really be
            the second thing, preceded by an XML declaration, but everyone leaves that
            out anyway.

            Lotta
          • Mike Breiding - Morgantown WV
            ... Hmmm... I think I get it. The XML declaration ( version, etc) should precede the doctype. I fell into using XHTML by accident and have not really taken
            Message 5 of 9 , Oct 1, 2006
              At 10:05 AM 10/1/2006 , you wrote:
              >OK, I think I get what you are after now. "All XHTML elements must be
              >nested within the <html> root element". The doctype isn't an element. It
              >should always be the very first thing. Except in XHTML it should really be
              >the second thing, preceded by an XML declaration, but everyone leaves that
              >out anyway.
              >
              >Lotta

              Hmmm...
              I think I get it. The XML declaration ( version, etc) should precede the
              doctype.
              I fell into using XHTML by accident and have not really taken much time to
              learn the basics.

              These helped:
              http://webdesign.about.com/od/xml/a/aa062501a.htm
              http://www.wdvl.com/Authoring/Languages/XML/Tutorials/Intro/declare.html

              Thanks!
              -Mike



              ----------
              Check it out:
              www.EpicRoadTrips.us

              [Non-text portions of this message have been removed]
            • loro
              ... Yes, should. But you mustn t. No one uses it because it puts IE in Quirks Mode. You are fine without as long as you keep to Ascii characters (if you don t
              Message 6 of 9 , Oct 1, 2006
                Mike Breiding - Morgantown WV wrote:
                >I think I get it. The XML declaration ( version, etc) should precede the
                >doctype.

                Yes, should. But you mustn't. No one uses it because it puts IE in Quirks
                Mode. You are fine without as long as you keep to Ascii characters (if you
                don't use a UTF-8 capable editor).
                http://www.w3.org/TR/xhtml1/#C_1


                >I fell into using XHTML by accident and have not really taken much time to
                >learn the basics.

                Fall out again. It won't hurt a bit. ;-o)

                Lotta
              Your message has been successfully submitted and would be delivered to recipients shortly.