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

Re: [NH] LOCAL XHTML TESTING

Expand Messages
  • sisterscape
    Some of the best discussions and tips ever on these issues can be found at http://www.sitepoint.com/forums/forumdisplay.php?f=1 My advice is that you code
    Message 1 of 8 , Dec 12, 2004
    • 0 Attachment
      Some of the best discussions and tips ever on these issues can be found
      at http://www.sitepoint.com/forums/forumdisplay.php?f=1 My advice is
      that you code your site in the DOCTYPE you will be using. Switching at
      the last minute has been known to create problems. Quirks mode is
      triggered accidentally in xhtml by using the xml prologue or in fact by
      having any content above the DOCTYPE. Why not use xhtml 1.0
      transitional rather than HTML 4.01. And BTW, W3C validation and cross
      browser compatibility are two different things. Code can validate
      perfectly and bomb in some browsers.

      This thread is especially helpful
      http://www.sitepoint.com/forums/showthread.php?t=171943


      --- weigheyeman <gft89@...> wrote:

      >
      > Hi,
      > I'm an experienced real time software engineer getting involved in
      > Web design. I have done a lot of reading, both books and web pages
      > and, after a lot of heart searching, have arrived at the following
      > strategy for developing web pages:
      >
      > 1. Develop and test the site initially using an XHTML 1.0 strict
      > DOCTYPE until I have the site working to my satisfaction. This will
      > be done locally on my PC (I will not upload the site). I hope that
      > this will set me on the right road to producing well formed XHTML
      > code which will be ready when more browsers (IE) support XHTML. I
      > intend to follow the W3C compatibility rules (Annex C) to make sure
      > that my XHTML is backwards compatible with HTML.
      >
      > 2. I realise that there are difficulties presenting XHTML to some
      > browsers (IE in particular) and that I will end up with the browser
      > treating my code as HTML in "quirks" mode. For that reason I intend
      > to change to HTML 4.01 strict DOCTYPE before going live and carrying
      > out validation and final testing.
      >
      > That's the background. The question is what is the best way of
      > testing and validating my XHTML code locally? I am not very clear how
      >
      > browsers, validators/linters, Tidy etc manage doctypes when looking
      > at code. How can I be sure that they are treating the code as XHTML
      > 1.0 strict and not HTML?
      >
      > Can anyone point me at any interesting sites or offer any
      > suggestions?
      >
      > Thanks,
      >
      > Charlie
      >
      >
      >
      >


      __________________________________________________
      Do You Yahoo!?
      Tired of spam? Yahoo! Mail has the best spam protection around
      http://mail.yahoo.com
    • Don - htmlfixit.com
      ... We have one over at htmlfixit.com (http://htmlfixit.com/w3c-markup-validator/) and in some cases we customized the error messages in an effort to be more
      Message 2 of 8 , Dec 12, 2004
      • 0 Attachment
        Lee Underwood wrote:
        > Charlie,
        >
        > You can use the validators at:
        > http://validator.w3.org/
        >
        > They have one there of online pages as well as locally. It will read the
        > DOCTYPE in your page and validate it accordingly.
        >
        > Lee

        We have one over at htmlfixit.com
        (http://htmlfixit.com/w3c-markup-validator/) and in some cases we
        customized the error messages in an effort to be more explanative. But
        either ours or the one at w3.org will do a local file. You may prefer
        to load it in a text directory on-line however. It isn't all that tough
        to get things so they look good accross the board and validate as strict
        xhtml ... you are way to serious about this, loosen up and have some fun
        there my friend. :-)
      • ontrack100@adelphia.net
        Hi Charlie, Here are the available DOCTYPES. put on eof these at hte very top of your HTML code pages: HTML 4.01 Strict, Transitional, Frameset
        Message 3 of 8 , Dec 12, 2004
        • 0 Attachment
          Hi Charlie,

          Here are the available DOCTYPES. put on eof these at hte very top of your HTML code pages:

          HTML 4.01 Strict, Transitional, Frameset

          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
          "http://www.w3.org/TR/html4/strict.dtd">


          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
          "http://www.w3.org/TR/html4/loose.dtd">


          <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN"
          "http://www.w3.org/TR/html4/frameset.dtd">

          XHTML 1.0 Strict, Transitional, Frameset

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">


          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
          "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

          XHTML 1.1 DTD

          <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
          "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">


          I store these in a NoteTab snippet and insert as needed.

          A great developer's site that these were pulled from
          is: A LIST APART
          http://search.atomz.com/search/?sp-q=DOCTYPES&sp-a=sp1002d27b&sp-f=ISO-8859-1&sp-p=All&sp-k=All

          - these are top notch pros who know their stuff!

          Hope this helps you and ohters out here.

          Regards,

          Rob Henrichon
          Ontrack Interactive Media Design
          129 Spruce St.
          Rutland, VT. 05071

          Voice: 802-773-8874
          Mobile: 802-236-2038
          email: ontrack100@...

          ---- sisterscape <sisterscape@...> wrote:
          >
          > Some of the best discussions and tips ever on these issues can be found
          > at http://www.sitepoint.com/forums/forumdisplay.php?f=1 My advice is
          > that you code your site in the DOCTYPE you will be using. Switching at
          > the last minute has been known to create problems. Quirks mode is
          > triggered accidentally in xhtml by using the xml prologue or in fact by
          > having any content above the DOCTYPE. Why not use xhtml 1.0
          > transitional rather than HTML 4.01. And BTW, W3C validation and cross
          > browser compatibility are two different things. Code can validate
          > perfectly and bomb in some browsers.
          >
          > This thread is especially helpful
          > http://www.sitepoint.com/forums/showthread.php?t=171943
          >
          >
          > --- weigheyeman <gft89@...> wrote:
          >
          > >
          > > Hi,
          > > I'm an experienced real time software engineer getting involved in
          > > Web design. I have done a lot of reading, both books and web pages
          > > and, after a lot of heart searching, have arrived at the following
          > > strategy for developing web pages:
          > >
          > > 1. Develop and test the site initially using an XHTML 1.0 strict
          > > DOCTYPE until I have the site working to my satisfaction. This will
          > > be done locally on my PC (I will not upload the site). I hope that
          > > this will set me on the right road to producing well formed XHTML
          > > code which will be ready when more browsers (IE) support XHTML. I
          > > intend to follow the W3C compatibility rules (Annex C) to make sure
          > > that my XHTML is backwards compatible with HTML.
          > >
          > > 2. I realise that there are difficulties presenting XHTML to some
          > > browsers (IE in particular) and that I will end up with the browser
          > > treating my code as HTML in "quirks" mode. For that reason I intend
          > > to change to HTML 4.01 strict DOCTYPE before going live and carrying
          > > out validation and final testing.
          > >
          > > That's the background. The question is what is the best way of
          > > testing and validating my XHTML code locally? I am not very clear how
          > >
          > > browsers, validators/linters, Tidy etc manage doctypes when looking
          > > at code. How can I be sure that they are treating the code as XHTML
          > > 1.0 strict and not HTML?
          > >
          > > Can anyone point me at any interesting sites or offer any
          > > suggestions?
          > >
          > > Thanks,
          > >
          > > Charlie
          > >
          > >
          > >
          > >
          >
          >
          > __________________________________________________
          > Do You Yahoo!?
          > Tired of spam? Yahoo! Mail has the best spam protection around
          > http://mail.yahoo.com
          >
          >
          >
          > CSE HTML Validator Lite - it's free: http://home.earthlink.net/~5wink/dl/cselite652.exe
          >
          > Fookes Software Home: http://www.fookes.us/redir
          >
          > Yahoo! Groups Links
          >
          >
          >
          >
          >
          >
          >
        • loro
          ... Not sure if we mean the same thing with quirks mode ? Browser will treat XHTML as HTML, i.e. use their HTML parser, if the document is served as
          Message 4 of 8 , Dec 12, 2004
          • 0 Attachment
            weigheyeman wrote:
            ><snip>
            >2. I realise that there are difficulties presenting XHTML to some
            >browsers (IE in particular) and that I will end up with the browser
            >treating my code as HTML in "quirks" mode.

            Not sure if we mean the same thing with "quirks mode"? Browser will treat
            XHTML as HTML, i.e. use their HTML parser, if the document is served as
            text/html. Locally the same thing happens if you use the html extension. An
            .xhtml extension makes them use their XML parser.

            The browser can treat the document as HTML and still use Standards Mode
            (AKA Strict Mode) as the rendering mode. How the doctype is written is used
            as a trigger for Standards or Quirks Mode, but it has nothing to do with
            Strict or Transitional (X)HTML.
            <http://www.hut.fi/u/hsivonen/doctype.html>

            >For that reason I intend
            >to change to HTML 4.01 strict DOCTYPE before going live and carrying
            >out validation and final testing.

            I can understand that approach.

            >That's the background. The question is what is the best way of
            >testing and validating my XHTML code locally?

            Do you mean locally as in not connected to the Internet?
            I know only two options if you don't want to install one of the online
            validators on your own machine (which isn't all that easy, I'm told).

            ARV - the offline version of WDG's excellent validator and well worth its
            modest price.
            <http://arealvalidator.com/>

            Igor Podlubny's cool freeware for Notetab.
            <http://www.tuke.sk/podlubny/ov.html>

            Otherwise, just upload to one of the online validators. The w3c one has
            already been mentioned. WDG's is here:
            <http://www.htmlhelp.com/tools/validator/>

            >I am not very clear how
            >browsers, validators/linters, Tidy etc manage doctypes when looking
            >at code.

            Browsers don't understand doctypes. They just use them for their "doctype
            switching", as this rendering mode thing is called. Validators understand
            them very well a check a document's syntax against the corresponding
            doctype definition, DTD. Tidy and other lints typically didn't use to care
            about doctypes either, but that can have changed for all I know. Either
            way, they don't validate the document against a DTD.

            >How can I be sure that they are treating the code as XHTML
            >1.0 strict and not HTML?

            To sum up, browsers only care about HTML or XHTML (they don't know Strict
            and Transitional). The trigger is the content-type from a server and the
            extension locally.
            Validators use the DTD you refer to in the doctype.
            Lints do what lints do, whatever that is. ;-)

            Lotta
          • Grant Mackenzie
            ... //this will trigger quirks, get rid of it Only if you put the xml proccessing instruction on top of the Doc..
            Message 5 of 8 , Dec 12, 2004
            • 0 Attachment
              >Hi,
              >I'm an experienced real time software engineer getting involved in
              >Web design. I have done a lot of reading, both books and web pages
              >and, after a lot of heart searching, have arrived at the following
              >strategy for developing web pages:
              >
              >1. Develop and test the site initially using an XHTML 1.0 strict
              >DOCTYPE until I have the site working to my satisfaction. This will
              >be done locally on my PC (I will not upload the site). I hope that
              >this will set me on the right road to producing well formed XHTML
              >code which will be ready when more browsers (IE) support XHTML. I
              >intend to follow the W3C compatibility rules (Annex C) to make sure
              >that my XHTML is backwards compatible with HTML.
              >
              >2. I realise that there are difficulties presenting XHTML to some
              >browsers (IE in particular) and that I will end up with the browser
              >treating my code as HTML in "quirks" mode.

              <?xml version="1.0" encoding="UTF-8"?> //this will trigger quirks, get rid
              of it
              Only if you put the xml proccessing instruction on top of the Doc..
              otherwise quirks mode is not triggered.

              >For that reason I intend
              >to change to HTML 4.01 strict DOCTYPE before going live and carrying
              >out validation and final testing.

              Why?
              Leave the DOCTYPE as xhtml strict.
              give it a html or htm extension and the server will serve it as text/html
              your browser is happy ... it loads and parses as an html doc
              however your doc is now bipolar..
              can be loaded into sgml parser( a browser ) and rendered like html..
              can be loaded into xml parser ( may be a xml parser in a browser, maybe not
              ... )

              >That's the background. The question is what is the best way of
              >testing and validating my XHTML code locally?

              The way i do it is to load it into a validating xml parser..
              msxml 4 does the trick..

              I've got a little notetab clip that
              replaces the Public Doctype to a local one
              ^!Set %dtSystem%=<!DOCTYPE html SYSTEM "^$GetAppPath$DTD\xhtml1-strict.dtd">

              it then calls a script from WSH

              ^!Set %file%="^$GetScriptPath$validateByDTD.js"
              ^!Set %arg%=^$GetDocName()$
              ^!Set %arg%=^$StrReplace("\";"\\";"^%arg%";0;0)$
              ^!Set %out%=^$StrTrim(^$GetInputOutput(cscript "^%file%" "^%arg%"
              //NoLogo )$)$

              the ^%file% contains the following..small jscript

              var stdout = WScript.StdOut;
              var x
              var file = WScript.Arguments.Unnamed(0)
              stdout.WriteLine(file)
              //instantiate latest msxml parser
              x = new ActiveXObject("Msxml2.DOMDocument.4.0");
              x.async = false;
              x.validateOnParse = true;
              x.resolveExternals = true;
              if(!x.load(file))
              {
              var err = x.parseError
              if(err.errorCode != 0)
              {
              stdout.WriteLine(err.reason);
              stdout.WriteLine('line:#: ' + err.line + ' ');
              stdout.WriteLine('linepos: ' + err.linepos);
              }
              }
              else
              {
              stdout.WriteLine("Valid against strict DTD " + x.parsed)
              }

              I replace the doctype back ..
              and go to position curser at line error if there is one...


              ^!Set %errLinePos%=^$StrTrim(^$StrCopy(^%out%;^$Calc(^%idx%+7)$;6)$)$
              ^!Info ^%out%
              ^!IfTrue ^%Public% ^!Replace "^%dtSystem%" >> "^%dtPublic%" CIWHS
              ^!SetCursor ^%errLinePos%:1
              ^!GOTO END

              Viola its done ...
              file is validated against the DTD and this is done locally



              >I am not very clear how
              >browsers, validators/linters, Tidy etc manage doctypes when looking
              >at code. How can I be sure that they are treating the code as XHTML
              >1.0 strict and not HTML?
              >
              >Can anyone point me at any interesting sites or offer any suggestions?
              >
              >Thanks,
              >
              >Charlie





              CSE HTML Validator Lite - it's free:
              http://home.earthlink.net/~5wink/dl/cselite652.exe

              Fookes Software Home: http://www.fookes.us/redir



              Yahoo! Groups Sponsor
              ADVERTISEMENT






              Yahoo! Groups Links

              To visit your group on the web, go to:
              http://groups.yahoo.com/group/ntb-html/

              To unsubscribe from this group, send an email to:
              ntb-html-unsubscribe@yahoogroups.com

              Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
            • weigheyeman
              Hi again, Thanks to everyone who replied. I thought I had done a lot of reading on the subject but you ve given me lots to think about. I definitely understand
              Message 6 of 8 , Dec 14, 2004
              • 0 Attachment
                Hi again,
                Thanks to everyone who replied.
                I thought I had done a lot of reading on the subject but you've given
                me lots to think about. I definitely understand the DOCTYPE and
                rendering thing a lot better now.
                Regards,

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