W3C Validator - quick q for experienced coders

Status
Not open for further replies.

bamme

Senior Member
Hi guys

Ive been using the w3c html validator for the page attached. ive never used it before (shame)!

I was planning to use it for each page before classing the project as finalised. the site works on firefox, safari, and ie 6 7 and 8.

I pasted my code in, checked the 'clean up with html tidy' option, and clicked 'check'.

Out came a massive list of errors and one warning. A couple errors were apparent and stupid of me (i included an alt attribute twice for 2 img elements) but most i did not understand, nor did they - when looking - seem wrong or invalid.

The code it gave me after the list of errors contained little bits saying CDATA or similar.. which didnt seem to do anything but make the code look weird..

I wondered:

1) Is validating through this html validator completely necessary?

2) i dont even understand let alone know what some of these errors were pointing out - they did not look like errors when meticulously going back over the code.. are these vital or needed to be changed?

3) the code at the end of the validators page after its list of errors - is this a fixed version without the errors? i couldnt see any different..

thanks for the help people. i have attached a html file incase you wanted to run it thru the validator yourself and see what i mean!

1)
 

Attachments

  • about.html.zip
    4.8 KB · Views: 3
hi - thanks very much :) I realised about the end of the CDATA bit - that was a stupid error but i didnt actually notice that was causing problems before i attached the file hah! I pretty much just wanted to know if the validator was needed for it to be good code..

thanks for sending the valid page - how do i get the validator to give me a fixed, error free, valid page on my own?

..on my own.. sounds like a baby..

emma
 
emmaburge said:
thanks for sending the valid page - how do i get the validator to give me a fixed, error free, valid page on my own?

Hi Emma, that's it!.. just add the bit I mentioned to close off the cdata bit, that being left open was making bits of otherwise valid code error!

Unless I'm missing something? - that's all I changed!

Andy
 
Hey Emma.
The thing about the validator is that errors cascade and 1 error could flag up 15 or more seperate errors because of overlapping tags.

Always work from the top down and it will only take you a min to sort out and that huge list of errors drops really fast when you start fixing them trust me.

But yeah it is good to check even if the site works well, as you say you had 2 alt attributes which would be a pain for disabled users, and I'm not sure how it would be seen in the search engines either.

What other errors are you getting and myself or 1 of the others can help you to correct them.
 
Just to answer some of the question

Validating is not necessary but it is definitely ADVISED, especially if you are not sure as to why the issues are being flagged. If you know why you are more likely to be able to choose whether or not the error is necessary to be fixed, if you do not know why then it is better practise to fix them (or find out why)

The validation is a system created to make a set standard for the web, the only issues with this is a governing board choose what validates and what doesn't, but in theory is an excellent idea.
 
renniks - Thanks for the advice - i will make a habit of using the validator in future but i think itll only become useful once i understand what its telling me is wrong..

Thanks also jazajay for your offer to help me -

I put this page into the validator: Ann Bridgland Education Services - information and study for teachers parents carers local authorities and headteachers

And here is its result now:
[Invalid] Markup Validation of http://www.ameliealden.com/stf/test/about.html - W3C Markup Validator

im confused about those errors - the ones i understood i fixed, but i dont get what this is trying to tell me..
 
Emma, you don't seem to have understood my posts!

The reason you are getting errors is because you have not closed off the CDATA bit. That is what is causing the errors further down in your code. if you fix the cdata bit the other bits will NOT error!

pdf highlighting the problem here: http://www.marketinginitiative.co.uk/cdata.pdf
let me know if you don't understand.
 
Basically you are using the XHTML strict doctype, which I may add is very good, so under XHTML strict you cant have in-line JavaScript on a page, if you do, and use XHTML strict which you are doing, you need to escape it with the cdata comments, as Harry and Tbwcf rightly says.

Sorry didn't see your post Tbwcf, or that you gave her the right solution from the off. :)

So for each in-line script tag change it to this ~
<script type="text/javascript">
//<![CDATA[ //Beginning
JavaScript rules go in here
//]]> //Closing
</script>


Your getting that error because you haven't closed the closing cdata comment here ~
onLoadSlideOut: false
});
});
//]]> //Needs to be added to fix the error
</script>

The bit in bold you haven't added, but need to.

That, Tbwcf solutions, will then by the looks of it fix all 9 errors, as I say they cascade, hope that explains also why it needs to be like that as well.

Jaz

Key:
Brown ~ JavaScript
Orange ~ Comment
 
Ahh thanks Harry, missed that - also didnt realise running the code thru html tidy actually rids the page of errors :)

Thanks for all the help people!
 
well just say thank you and a list then I will close the thread so its always the last post :)

Or sending chocolates (or Pies in Typo's case) is another option :) LOL
 
Sounds like a good idea..a pie might get a bit battered in a mail package heh..

Thanks to:
tbwcf
Jazajay
renniks
Harry

for helping with this problem :)
 
Status
Not open for further replies.
Back
Top