SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Guru bronze trophy AndrewCooper's Avatar
    Join Date
    Sep 2008
    Location
    Manchester, UK
    Posts
    631
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Character Entity Data Problem With Validating

    Ok, I want this to happen in my navigation:

    Home | Contact | About | Terms of Service

    Blah blah. This thing here "|" <<<< Is causing me a problem when validating the page as XHTML 1.0 Strict.

    Here's what I get from W3:

    Line 19, Column 54: character data is not allowed here.
    <li><a href="index.html" title="Home">Home</a></li> -✉
    You have used character data somewhere it is not permitted to appear. Mistakes that can cause this error include:

    putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>), or
    forgetting to quote an attribute value (where characters such as "%" and "/" are common, but cannot appear without surrounding quotes), or
    using XHTML-style self-closing tags (such as <meta ... />) in HTML 4.01 or earlier. To fix, remove the extra slash ('/') character. For more information about the reasons for this, see Empty elements in SGML, HTML, XML, and XHTML.
    I've tried using others, as you see in that example, such as - instead of | specifically. I've also tried using other methods such as &middot; and that still doesn't validate for me.

    What do I need to do to that markup to have it validate in XHTML 1.0 Strict? I've had a look at tonnes of Character Entity tables, even at the W3 site but there isn't one for the | character.

    A really really prompt reply would be great!

    Thanks,

    AndrewCooper

  2. #2
    Pedantic Semantic blain's Avatar
    Join Date
    Mar 2006
    Location
    Yorkshire, UK
    Posts
    528
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It actually tells you what you are doing wrong.

    Mistakes that can cause this error include:

    putting text directly in the body of the document without wrapping it in a container element (such as a <p>aragraph</p>)
    I assume you are doing this

    Code HTML4Strict:
    <li><a href="index.html" title="Home">Home</a></li> |

    When you should be doing this

    Code HTML4Strict:
    <li><a href="index.html" title="Home">Home</a> |</li>
    Technology is dominated by two types of people:
    those who understand what they do not manage,
    and those who manage what they do not understand.

  3. #3
    SitePoint Guru bronze trophy AndrewCooper's Avatar
    Join Date
    Sep 2008
    Location
    Manchester, UK
    Posts
    631
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    When I read that bit, I thought it meant I actually had to wrap it in paragraph tags and didn't want to do that obviously, buuuut now I get it totally!

    And I know now I understand it, It isn't a big thing but...

    HOLY CRAP THANK YOU SO MUCH! Seriously, I'm so glad there was a solution to that. -Phew- My websites now XHTML 1.0 Strict Validated

    Thanks for the help! Sometimes I get confused with the comments they make, not that clear sometimes I reckon.

    Thanks very much and a Merry Christmas to you!

    AndrewCooper

  4. #4
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    A better idea would be to replace that veritcal pipe with a CSS border on the anchor or list item That way you can remove the extra HTML code (that's not even needed) and put the presentational "element" in the stylesheet.

  5. #5
    SitePoint Guru bronze trophy AndrewCooper's Avatar
    Join Date
    Sep 2008
    Location
    Manchester, UK
    Posts
    631
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Hmmm you're right. Absolutely brilliant idea. I would just add a span class to the links I want to add it at the end of, right?

    But saying that though, I don't want the vertical pipe right at the end of the text. I want it with a space in between the texts last letter and the vertical pipe. Would I add padding-right to it or something else?

    Thanks for the brilliant idea and the help! I keep on learning more efficient CSS code every day! =D and a Merry Christmas to you!

    AndrewCooper

  6. #6
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    No need for a span. Just style either the anchor or the list item directly. And yes you'd use padding.

    And a Merry Christmas to you too.

  7. #7
    SitePoint Guru bronze trophy AndrewCooper's Avatar
    Join Date
    Sep 2008
    Location
    Manchester, UK
    Posts
    631
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    I think I'd use list item directly because I only want it in that list. However, I don't want the vertical pipe for the end link, and if I styled it with the list item, wouldn't it add the vertical pipe at the end of that last link too?

    Thanks for the help! And thanks for the Merry Christmas too! =D

    AndrewCooper

  8. #8
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Just add a class to the last link and style it differently.

    Granted, you could use last-child but IE (up to version 7) doesn't support that.

  9. #9
    SitePoint Guru bronze trophy AndrewCooper's Avatar
    Join Date
    Sep 2008
    Location
    Manchester, UK
    Posts
    631
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    Just add a class to the last link and style it differently.
    Thought so. I'll do just that then! Thanks very much Dan! =]

    Granted, you could use last-child but IE (up to version 7) doesn't support that.
    Hmm, good idea. Do all other major browsers support last-child? And if yes, then does IE8 support last-child? If so I can just updated the navigation code again, when IE8 releases.

    AndrewCooper

  10. #10
    In memoriam gold trophysilver trophybronze trophy Dan Schulz's Avatar
    Join Date
    May 2006
    Location
    Aurora, Illinois
    Posts
    15,476
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Yes, they do, actually. But if you're going to use the class, why bother using last-child as well?

  11. #11
    SitePoint Guru bronze trophy AndrewCooper's Avatar
    Join Date
    Sep 2008
    Location
    Manchester, UK
    Posts
    631
    Mentioned
    10 Post(s)
    Tagged
    0 Thread(s)
    I meant, I'll just use the span for now, and when IE8 is released, and if it supports the last-child, I'll update the navigation to have last-child instead of the span class.

    4 Minutes after minute here in UK, Merry Christmas Dan!

    AndrewCooper


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
  •