dcsimg
www.webdeveloper.com
Results 1 to 8 of 8

Thread: XHTML 1.0 Strict Validation error, I don't understand

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    USA
    Posts
    30

    Question XHTML 1.0 Strict Validation error, I don't understand

    I attached a screenshot for simplicity.
    This screenshot is less compressed than the attachment: here:

    I'm not sure what this error is telling me. This code was taken right from the HTML, XHTML & CSS sixth edition Elizabeth Castro book. Although she used Transitional, which works across Firefox, IE, Chrome. However, when I use Strict, it works fine in Firefox, and Chrome, but IE 8 ignores the styles. However, I think the last issue is more related to IE being thrown into corks mode. So I would naturally use transitional for this.

    But with regard to strict 1.0 I don't understand this error.
    Attached Images Attached Images
    Last edited by waveform; 03-10-2013 at 09:40 PM.

  2. #2
    Join Date
    Jun 2007
    Location
    USA
    Posts
    30
    I passed the validation by adding P tags around the links. But I don't understand why they were needed.
    I think links are inline elements, and I know you can't add block level elements to inline, but that was not the case.
    There was nothing else on the page, just the links themselves. So why do they need to be enclosed in some type of block level element? Is that the rule for XHTML strict 1.0?


    <p>
    <a href="home.html">home</a>
    <a href="about.html">about</a>
    <a href="examples.html">examples</a>
    <a href="extras.html">extras</a>
    <a href="opinions.html">opinions</a>
    <a href="help.html">help</a>
    </p>
    Last edited by waveform; 03-11-2013 at 12:21 AM.

  3. #3
    Join Date
    Jul 2003
    Location
    The City of Roses
    Posts
    2,503
    According to the spec, only block elements -- not inline -- can be direct children of the body.
    for(split(//,'))*))91:+9.*4:1A1+9,1))2*:..)))2*:31.-1)4131)1))2*:3)"'))
    {for(ord){$i+=$_&7;grep(vec($s,$i++,1)=1,1..($_>>3)-4);}}print"$s\n";

  4. #4
    Join Date
    Jun 2007
    Location
    USA
    Posts
    30
    Thank you Jeff for the direct and precise explanation.
    I should probably put some time into reading the specs. I was kind of hesitant on reading any WC3's explanations at this point. I find many technical spec documentation difficult to understand because of how they word things. (same difficult situation with reading Linux Man pages when you're new..lol) But you're explanation was priceless and very clear. Thank you!

    At the moment I've just been working out of a book, and watching videos here-and-there. What I find odd is, the book I'm using recommends only writing clean strict code, yet "all" the doc types through out the book use transitional. It is a great book, but I was surprised it didn't mention this. and I've been scanning the chapters front to back.

    Thanks again for the help Jeff!
    Last edited by waveform; 03-11-2013 at 06:13 PM.

  5. #5
    Join Date
    Mar 2013
    Posts
    7
    Another fix that would work is to set the hyperlinks themselves to be block elements in the CSS:

    a { display: block; }

    This way your XHTML markup remains the same as before, and is less cluttered, and you just have a little extra CSS. Saves a little bandwidth.

    Personally I find some of the rules for 'strict' to be a bit arbitrary to be honest. I've often encountered similar validation errors and much as I can normally figure out what rules I'm breaking, I don't really understand the justification for having those rules anyway. They seem to be driven more by some kind of dogma than by practical considerations. I tend to stick to transitional these days rather than strict as life is too short to waste on arbitrary formatting issues just to keep the w3c validator happy.

  6. #6
    Join Date
    Jun 2007
    Location
    USA
    Posts
    30
    Good tip, Thank you Flack
    I do recall recently reading about changing an element with display, but didn't understand the books explanation for what it was used for.
    However, it makes perfect sense in the context you mentioned. Good to know.

    I know how you feel with regard to complying with strict. I notice most pages still use transitional which Is fine I guess for most pages. On the other hand, according to my book titled: Xhtml css 6 Elizabeth Castro, it says in order to take advantages of things like databases, you have to use strict. SQL databases is really the reason for me learning PHP. Though I have seen pages with database's and forms using Transitional, I don't really know what limitations one would run into by not using strict, so I figured I would just take the long way and learn it. But somethings do seem redundant. I have much to learn still.



    Thanks again, Flack and Jeff! - Much appreciated!
    Last edited by waveform; 03-18-2013 at 02:09 AM. Reason: spelling

  7. #7
    Join Date
    Mar 2013
    Posts
    7
    You don't need to use XHTML strict or any other particular flavour of HTML to use databases, it has no bearing or effect on how a site integrates with a database. It may have an effect on how the data you pull from a database displays, but that is true of any data on a page whether it came from a database or not. As long as your HTML can be parsed by a browser so it can see what form fields you're passing, then it really doesn't matter what HTML format you use. The form handler receives the same input, and the database process happens the same as it would whether your page is displaying in XHTML strict, transitional or quirks mode even.

    The most important thing if you're getting into databases is to read up on SQL injection and how to avoid it, i.e. parametrized queries and stored procedures. This is what you need to know before you start working with online databases, regardless of what scripting platform or database you're using. You don't want your first knowledge of SQL injection to be after your first site gets hacked!

  8. #8
    Join Date
    Jun 2007
    Location
    USA
    Posts
    30
    Thanks again Flack.
    I've actually put SQL off to the side for the moment to focus on CSS and PHP. But that's good to know. After you mentioned that the other night, I ran though the security section of my SQL books and they have whole sections dedicated to injections. I'm just not there yet. But security is going to be a major concern at some point. I'll keep this in the back of my head.

    By the way,
    At the moment, I'm keeping templates with comments of all the things I'm learning. However, although I have memorized a lot with regard to syntax rules, ..and even structuring things like basic css selectors, I often have to keep going back to reference my notes on certain property names, or sometimes I'll forget how to structure something. I sometimes wonder if I have a bad memory or if it's just that I'm still new to this. I spend a lot of time studying the rules. I guess at this point, I need to just make up projects for myself and it will sink in. Like the doc type for example, I just copy and paste that. If I don't make myself memorize it, I'll never remember it.
    Last edited by waveform; 03-19-2013 at 09:17 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

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



Recent Articles