• 0

w3c validation insanity


Question

OK so I've been working on this site for a university project and i've come to validate the XHTML and found this: http://validator.w3.org/check?uri=http%3A%2F%2Fjusebox.tk%2Fbrowse.php&charset=%28detect+automatically%29&doctype=Inline&group=0&user-agent=W3C_Validator%2F1.2

Most of (if not all) of these errors are due to either characters in URLs which occur in javascript, or characters which occur in RSS feeds, which I am echoing out via PHP. I have absolutely no idea how to tackle this issue and get this to validate. Can anyone help me out?

the page is at http://jusebox.tk/browse.php

Cheers :)

Link to comment
https://www.neowin.net/forum/topic/1000704-w3c-validation-insanity/
Share on other sites

12 answers to this question

Recommended Posts

  • 0

I'd recommend one of two things:

1. Put your javascript in a separate .js file and load it. This gets around all possible problems of the kind you're having.

or

2. Use the CDATA feature, e.g.

<script type="text/javascript">

<![CDATA[

// Your javascript code

]]></script>

  • 0

this si how my js works:

&lt;script type="text/javascript"&gt;
		var last_url;

		$(document).ready(function(){
		   manage_goto();
		});

		function manage_goto(){
			$('#go_to').click(function(){
			  last_url =  $('#url').val();
			  load_page();
			});
			$('.all_feeds a').click(function(){
			   last_url = $(this).attr('href');
			   load_page();
			});
		}

		function load_page(){

			update_fb_link();

		}


		function update_fb_link(){
			var share_url = 'http://www.facebook.com/sharer.php?t=Sharing&u='+last_url+'&title=via+Jusebox'#fb_link').attr('href', share_url);			
		}

I've tried changing the ampersands but as I said it renders the links useless.

Also, I don't actually know how to write php lol. I have a friend who helped me out with it but I can;t get through to him at the moment. I read those links you sent me and although I understand how it works, I have know idea how to implement it. This is my code:

&lt;?php
					$doc = new DOMDocument();
					$doc-&gt;load("http://feeds.eonline.com/eonline/uk/topstories?format=xml");
					$arrFeeds = array();
					foreach ($doc-&gt;getElementsByTagName('item') as $node) {
						$itemRSS = array ( 
							'title' =&gt; $node-&gt;getElementsByTagName('title')-&gt;item(0)-&gt;nodeValue,
							'link' =&gt; $node-&gt;getElementsByTagName('link')-&gt;item(0)-&gt;nodeValue,
							'description' =&gt; strip_tags($node-&gt;getElementsByTagName('description')-&gt;item(0)-&gt;nodeValue),
							);
						array_push($arrFeeds, $itemRSS);
					}

					foreach ($arrFeeds as $value) {
						echo "&lt;a class='rss_link' target='frame' href='".$value[link]."'&gt;".$value[title]."&lt;/a&gt;";
						echo	substr("&lt;p class='rss_description'&gt;".$value[description], 0, 200).'...&lt;/p&gt;';
					}

					?&gt;

any idea how i should go about this? Anything anyone can come up with is really appreciated! My deadline is nearing lol :s

  On 27/05/2011 at 20:31, DonC said:

I'd recommend one of two things:

1. Put your javascript in a separate .js file and load it. This gets around all possible problems of the kind you're having.

or

2. Use the CDATA feature, e.g.

<script type="text/javascript">

<![CDATA[

// Your javascript code

]]></script>

thats a really good idea, having the js in a separate file. I'll try that now. thanks :)

  • 0

really? I just created separate js files for the offending script and it works like a charm.

just out of interest (i'm learning, lol) would it be better practice to use the CDATA tags and if so why?

Also, is there anything you could suggest to treat my php problem? thanks :blush:

  • 0

What I meant to say is when you print links use htmlspecialchars function to encode special characters like & so that it validates with W3C. When you are using this data in JavaScript perform a global replace of & with & and then proceed. That way the scripts will work and the page will validate.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • Too many middle managers at these big companies are the problem imo. The guys under them do all the work but these VPs or PMs fight with each other in order to move up the ladder which just messes things up.
    • Microsoft lifts another long-standing Windows 11 24H2 block, allowing more people to upgrade by Taras Buria In October 2024, Microsoft released Windows 11 version 24H2 with quite a long list of known bugs and upgrade blocks. Ever since, Microsoft has been slowly patching those bugs and lifting blocks one by one. Now, the company is removing another upgrade block, letting more Windows 10 and Windows 11 users upgrade to the latest version ahead of the upcoming end of Windows 10 support. The block in question affects PCs with Easy Anti-Cheat, an anti-cheat solution embedded in many popular games, such as PUBG or Fortnite. According to the official documentation, the compatibility issue affects systems with Intel's Alder Lake+ processors and the vPro platform with Easy Anti-Cheat drivers released before April 2024. Affected systems crash to the blue screen of death (now black screen of death) with the "MEMORY_MANAGEMENT" error. However, blue screens of death do not occur if games do not use outdated drivers that are present on the device. The upgrade block was placed on September 30, 2024, and now, nearly ten months later, Microsoft has lifted it. As of July 24, 2025, affected systems can finally install Windows 11 version 24H2 via Windows Update. Note that Windows Update might still prompt you to update games that use an incompatible Easy Anti-Cheat version. Compatibility issues with Easy Anti-Cheat are only present in Windows 11 version 24H2, so if you are running older Windows 11 versions or Windows 10, there should not be any crashes, even with outdated drivers. Windows 11 version 25H2 is coming in a couple of months, but its predecessor still has several upgrade blocks in place. There are compatibility issues with Intel Smart Sound Technology drivers, hanging apps that use the camera, audio output losses on PCs with Dirac Audio, and sprotect.sys driver issues.
    • XRECODE3 1.169 by Razvan Serea xrecode3 is a converter and audio-grabber which allows you to convert from mp3, mp2, wma, aiff, amr, ogg, flac, ape, cue, ac3, wv, mpc, mid, cue ,tta, tak, wav, wav(rf64), dts, m4a, m4b, mp4, ra, rm, aac, avi, mpg, vob, mkv, mka, flv, swf, mov, ofr, wmv, divx, m4v, spx, 3gp, 3g2, m2v, m4v, ts, m2ts, adts, shn, tak, xm, mod, s3m, it, mtm, umx, mlp to m4a, alac, ape, flac, mp3, mp4 (using NeroAAC), ogg, raw, wav, wav(rf64), wma, WavPack, mpc, mp2, Speex, ofr, ac3, aiff, tak, snd and Shorten formats. Command Line parameters are supported. XRECODE3 features: Works on XP, Vista, Windows 7, Windows 8, 10 32/64 bit versions and under Wine. Parallel conversion by utilizing power of multi-core CPUs. Support of embedded CUE sheets (for FLAC, WavPack, APE and TAK files). Support of mp4, mka chapters (can split mp4, mka by chapters to any supported format). Built-in Metadata editor with Cover Art support. Has support for LossyWav. Supports portable mode. Merge input files to one large audio file and create CUE sheet. Converting to many formats at once using "Multiple" output mode. Grabbing of multi-channel Audio CDs to the desired format at once. Informative and resizable UI suited even for netbooks. Extracting audio from flv, avi, mov etc. video files (multiple audio streams are supported). Can export/import Metadata to/from external file. Support for 24/32bit audio files. Multilanguage support. Currently program is available in Dutch, English, French, Japanese, Korean, Polish, Russian, Hungarian, Italian, Spanish, Spanish Traditional, Swedish, Brazilian Portuguese, German, Finnish, Bulgarian, Czech, Danish and Chinese (simplified) languages. What's new in XRECODE3: Native 64bit support. Added support for DSD/DST and DFF formats (including handling of SACD ISOs). Added option to extract audio without transcoding. Added option to encode several files to one multi-channel file. Added option to split file into individual track-per-channel for all available output formats. Added option to merge files per folder. Output and Metadata settings are now output format specific. Enhanced Metadata settings. Added support for multiple Cover pictures in Metadata editor. Added 32bit int/float output for formats which support them (e.g. WAV). Added dithering option in Output Settings. Added option to use EBUR128 in Normalize. Added option to Album Mode Normalize. Added option to configure Matrices under Output Settings. Added more output file pattern elements. Tabbed UI. CUE files are now displayed more nicely. Enhanced Shell Extension. XRECODE3 1.169 changelog: FIX: resolved an issue where playlist file names was created with 2 dots before the file extension. FIX: fixed issue with encoding some files to ac3 format. Download: XRECODE3 v1.169 (64-bit) | Portable | ~30.0 MB (Shareware) Download: XRECODE3 v1.169 (32-bit) | Portable Link: XRECODE3 Homepage | XRECODE3 Screenshot Get alerted to all of our Software updates on Twitter at @NeowinSoftware
    • So... Tesla fails, SpaceX fails, not Starlink... I guess karma is a bitch...
    • Basically, they can hire someone with less skill for a lower wage, for example from India, and use AI to bring that employees output up to the level of someone more experienced and expensive. It’s a broad cost-cutting strategy, and plenty of companies are already doing it. With AI involved, the employee just needs to check that the AI's results aren’t complete junk. They don’t actually have to know how to produce the work themselves. You just get one high level employee to triple check who does. The workflow looks like this: AI generates the content, a low-skilled worker filters out anything clearly broken or wrong, and a high-skilled worker gives it a final pass. Instead of hiring a full team of experts, companies can rely on a few at the top while AI and cheaper labour handle the bulk of the process.
  • Recent Achievements

    • Week One Done
      Itbob513626 earned a badge
      Week One Done
    • One Month Later
      Itbob513626 earned a badge
      One Month Later
    • Rookie
      EdwardFranciscoVilla went up a rank
      Rookie
    • Week One Done
      MoJo624 earned a badge
      Week One Done
    • Collaborator
      aeganwn earned a badge
      Collaborator
  • Popular Contributors

    1. 1
      +primortal
      619
    2. 2
      ATLien_0
      242
    3. 3
      Xenon
      160
    4. 4
      Michael Scrip
      123
    5. 5
      +FloatingFatMan
      123
  • Tell a friend

    Love Neowin? Tell a friend!