Web Analytics Made Easy -
StatCounter Minimal valid document - CodingForum

Announcement

Collapse
No announcement yet.

Minimal valid document

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Minimal valid document

    It's amazing how compact SGML can be made compared to XML...

    HTML 2.0:
    Code:
    <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
    <TITLE/</>
    HTML 3.2:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
    <TITLE/</>
    HTML 4.01:
    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN">
    <TITLE/</><P/
    XHTML 1.0:
    Code:
    <!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>
        <title/>
      </head>
      <body>
        <p/>
      </body>
    </html>
    Last edited by liorean; Mar 10, 2004, 03:18 PM.
    liorean <[[email protected]]>
    Articles: RegEx evolt wsabstract , Named Arguments
    Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
    Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

  • #2
    Is that last one valid? I thought you could only use the <p/> or <title/> closing method when the element was EMPTY in the dtd?
    David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
    W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

    Comment


    • #3

      Comment


      • #4
        In XML there is NO difference between <element/> and <element></element> whatsoever. In SGML there is, but that's because in SGML an empty element is considered self-terminating.
        liorean <[[email protected]]>
        Articles: RegEx evolt wsabstract , Named Arguments
        Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
        Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

        Comment


        • #5
          Is there any browser difference? Obviously tagsoup browsers would interpret it as non-closing but what about XML reading browsers? Actually, does IE interpret <element /> as XML-closed or just SGML-self closing?
          David House - Perfect is achieved, not when there is nothing left to add, but when there is nothing left to take away. (Antoine de St. Exupery).
          W3Schools | XHTML Validator | CSS Validator | Colours | Typography | HTML&CSS FAQ | Go get Mozilla Now | I blog!

          Comment


          • #6
            These aren't validating for me (and it's not due to the double 2nd opening body tag instead of the closing in the XHTML example). Only certain tags are allowed to close as <element />. But don't forget about XHTML 1.1:


            <?xml version="1.0" encoding="ISO-8859-1"?>
            <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
            <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
            <head>
            <title> New Document </title>
            </head>
            <body>
            </body>
            </html>


            Which is better though? XHTML 1.0 Strict is good, but 1.1 (I don't think there's any variations of it) is a bit more strict I think.
            Go to:
            http://www.TailsArchive.net/
            http://xfox.proboards21.com/

            Comment


            • #7
              The last example (the XHTML strict one) is not well-formed and thus not valid. The second <body> tag should be rather a closing </body> tag.

              EDIT: Posts crossed. Did some more tests.
              De gustibus non est disputandum.

              Comment


              • #8
                curious: WHAT'S THE POINT HERE PEOPLE..

                just to show the minimal amount you need for a valid document? like? whoopee? i'm confused..

                Comment


                • #9
                  Gee, calm down. I just missed that slash, it's fixed now.


                  It was a comparison between the languages - XML is clearly larger and more verbose than SGML. On the other hand, it's unambigous and easily readable. Have a look at <http://www.virtuelvis.com/download/162/evilml.html> for an example of a really obfuscated SGML document - valid HTML4.01, of course.
                  liorean <[[email protected]]>
                  Articles: RegEx evolt wsabstract , Named Arguments
                  Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
                  Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

                  Comment


                  • #10
                    Originally posted by liorean
                    XML is clearly larger and more verbose than SGML.
                    XML is just a cut down version of SGML anyway... so what do you expect? (All XML is SGML etc)

                    Besides, a minimal XML document would be more like this:

                    <node/>

                    Later,
                    Douglas
                    it's web design. me me me them everyone.
                    ~ No more Netscape. No more IE. What is the world comming to? ~

                    __ :: Our Tiny Planet

                    Comment


                    • #11
                      'me: Ie interprets it as tagsoup. XHTML and XML browser interpret it as a terminated element. Only DocZilla in SGML mode interprets it as SGML opening tag, followed by the character '>'.

                      Tails: You need a block level element within the body for it to validate. And as I said, XML doesn't do any difference between <element/> and <element></element> - no matter what the DTD says. The reason I can say this is the case? Why, canonical XML does a conversion from <element/> to <element></element> in the working source code.

                      See: <http://www.w3.org/TR/xml-c14n>

                      Note this excerpt:
                      Except for limitations regarding a few unusual cases, if two documents have the same canonical form, then the two documents are logically equivalent within the given application context.
                      DougBTX: Not quite. Until SGML was amended, some legal XML was illegal SGML. Anyway, what we were discussing was HTML/XHTML, not XML/SGML.
                      Last edited by liorean; Mar 10, 2004, 04:53 PM.
                      liorean <[[email protected]]>
                      Articles: RegEx evolt wsabstract , Named Arguments
                      Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
                      Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

                      Comment


                      • #12
                        Originally posted by liorean
                        And as I said, XML doesn't do any difference between <element/> and <element></element> - no matter what the DTD says. The reson I can say this is the case?
                        That's right; remember that any thing you can do with one piece of XML you should be able to do with anyother piece of XML. An XML phraser doesn't need to know about the XHTML DTD just becuse the XML it it reading happens to be XHTML.

                        Douglas
                        it's web design. me me me them everyone.
                        ~ No more Netscape. No more IE. What is the world comming to? ~

                        __ :: Our Tiny Planet

                        Comment


                        • #13
                          Well, the thing is that XML and XHTML govern different things. XML governs syntax and general format, while XHTML governs what elements and attributes are allowed, and where. The XML parsing comes in before the XHTML recognition, which means that in effect if the XML is well formed it is then checked for XHTML recognition - or validity checking for user agents that does that.
                          liorean <[[email protected]]>
                          Articles: RegEx evolt wsabstract , Named Arguments
                          Useful Threads: JavaScript Docs & Refs, FAQ - HTML & CSS Docs, FAQ - XML Doc & Refs
                          Moz: JavaScript DOM Interfaces MSDN: JScript DHTML KDE: KJS KHTML Opera: Standards

                          Comment

                          Working...
                          X