SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,287
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)

    Trying to read the specs

    I'm having a Stomme Poes moment-- feeling like our cat when it gets extra stupid.

    First, I cannot actually find the real XHTML specs as when you look for them you get this document stating basically that you should read HTML4 except this, that and the other: http://www.w3.org/TR/xhtml1/

    But I found a bloggity blog-blog-blog-dog with an actual list (from where he got it, I dunno):
    <!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
    Compare this with the HTML4 one, which you can read on the HTML4 spec page:
    <!ELEMENT FIELDSET - - (#PCDATA,LEGEND,(%flow;)*) -- form control group -->
    Even reading Tommy's Art of Reading the DTD I'm getting something not matching and it's confuzling.

    The | (pipe) symbol means "or" (I'm assuming a boolean "or"). So for XHTML it's saying one can have in a form
    -parsed character data or
    -a legend or
    -a block element or
    -another form! or
    -an inline element or
    -something else

    but as far as I know, forms are NOT allowed to contain other forms at all, not as direct children, not as descendants, not at all:
    Quote Originally Posted by section B
    form
    must not contain other form elements.
    So what does the above mean? How should I read it?

    Also, while the HTML4 DTD requires legends after fieldsets, I can send an XHTML 1.0 form to the validator and it doesn't say anything if there's a fieldset without a legend. Yet this is not listed as a difference on the XHTML1 W3C page, and I've been told that in fact a legend WAS still required but that a validator bug misses it. Which doesn't sound right. It seems they've changed it. The DTD listing above for XHTML forms is very different from the HTML4 one.

    So which is it, am I reading the listing for XHTML wrongly, or what? I only found the form one listed in the blog, but cannot find the listing for fieldset anywhere (I can't load a .dtd page in my browser... I'm going to try to copy it and save as text).
    Last edited by Stomme poes; Feb 17, 2009 at 06:53. Reason: smilies must die

  2. #2
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stomme poes View Post
    First, I cannot actually find the real XHTML specs as when you look for them you get this document stating basically that you should read HTML4 except this, that and the other: http://www.w3.org/TR/xhtml1/
    Yes, XHTML 1.0 is merely a reformulation of HTML 4.01 as an application of XML. It doesn't define any semantics of its own; it just copies that stuff from the HTML spec.

    Quote Originally Posted by Stomme poes View Post
    But I found a bloggity blog-blog-blog-dog with an actual list (from where he got it, I dunno):
    It's from the XHTML 1.0 DTD. There's an annotated version available in Appendix A of the XHTML 1.0 spec.

    Quote Originally Posted by Stomme poes View Post
    but as far as I know, forms are NOT allowed to contain other forms at all, not as direct children, not as descendants, not at all:
    That's right. In the HTML DTDs this is expressed using an exclusion:
    Code:
    <!ELEMENT FORM - - (%block;|SCRIPT)+ -(FORM)>
    But XHTML is defined with an XML DTD, which doesn't support inclusions and exclusions, so the exception is lost. The only way to find out is to read the HTML specification carefully.

    Quote Originally Posted by Stomme poes View Post
    Also, while the HTML4 DTD requires legends after fieldsets, I can send an XHTML 1.0 form to the validator and it doesn't say anything if there's a fieldset without a legend.
    I consider that a bug in the XHTML 1.0 DTD.

    Quote Originally Posted by Stomme poes View Post
    The DTD listing above for XHTML forms is very different from the HTML4 one.
    Yes. One reason is that XML DTDs are much less expressive than SGML DTDs, so there are many things that cannot be easily specified. But there are also weird deviations from the HTML grammar in some instances.
    Birnam wood is come to Dunsinane

  3. #3
    SitePoint Wizard Stomme poes's Avatar
    Join Date
    Aug 2007
    Location
    Netherlands
    Posts
    10,287
    Mentioned
    51 Post(s)
    Tagged
    2 Thread(s)
    Thanks Tommy. I did manage to copy the specs by just saving it and then renaming it to .txt (or whatever gEdit felt ok with) and then I could read it...

    <!ELEMENT form %form.content;> <!-- forms shouldn't be nested -->

    <!ATTLIST form
    %attrs;
    action %URI; #REQUIRED
    method (get|post) "get"
    enctype %ContentType; "application/x-www-form-urlencoded"
    onsubmit %Script; #IMPLIED
    onreset %Script; #IMPLIED
    accept %ContentTypes; #IMPLIED
    accept-charset %Charsets; #IMPLIED
    >
    Okay the comment in there makes sense if one cannot use +/- in XML dtd's...
    but fieldset is stil confuzling me:
    <!--
    The fieldset element is used to group form fields.
    Only one legend element should occur in the content
    and if present should only be preceded by whitespace.
    -->
    <!ELEMENT fieldset (#PCDATA | legend | %block; | form | %inline; | %misc;)*>
    <!ATTLIST fieldset
    %attrs;
    >
    Emphasis mine on the "if". Looks pretty deliberate. But anyway, looking at this, it's saying a legend is optional and it still seems to be saying it may have a form in it! Even though first of all, form should be able to be lumped under %block anyway, right? And second, the no forms in forms (one assumes fieldsets are not found outside of forms, right?). Why is form listed?
    Last edited by Stomme poes; Feb 17, 2009 at 07:18. Reason: damn smilies

  4. #4
    SitePoint Author silver trophybronze trophy

    Join Date
    Nov 2004
    Location
    Ankh-Morpork
    Posts
    12,158
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    As I said, it's probably because of the limitations in XML DTD syntax. The optional legend is quite inexplicable, though.
    Birnam wood is come to Dunsinane


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
  •