Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
  1. #1
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 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; 03-10-2004 at 08:18 PM.
    liorean <[lio@wg]>
    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
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #3
    Banned
    Join Date
    Jan 2004
    Location
    Minneapolis, MN
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts

  • #4
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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 <[lio@wg]>
    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

  • #5
    me'
    me' is offline
    Senior Coder
    Join Date
    Nov 2002
    Location
    Warwickshire, England
    Posts
    1,229
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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!

  • #6
    Regular Coder
    Join Date
    Nov 2002
    Posts
    672
    Thanks
    1
    Thanked 1 Time in 1 Post
    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.

  • #7
    Senior Coder
    Join Date
    Jun 2002
    Location
    frankfurt, german banana republic
    Posts
    1,848
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #8
    Banned
    Join Date
    Jan 2004
    Location
    Minneapolis, MN
    Posts
    387
    Thanks
    0
    Thanked 0 Times in 0 Posts
    curious: WHAT'S THE POINT HERE PEOPLE..

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

  • #9
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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 <[lio@wg]>
    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

  • #10
    New Coder
    Join Date
    Jul 2003
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #11
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    '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; 03-10-2004 at 09:53 PM.
    liorean <[lio@wg]>
    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

  • #12
    New Coder
    Join Date
    Jul 2003
    Posts
    88
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #13
    Master Coder
    Join Date
    Feb 2003
    Location
    UmeŚ, Sweden
    Posts
    5,575
    Thanks
    0
    Thanked 83 Times in 74 Posts
    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 <[lio@wg]>
    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


  •  

    Posting Permissions

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