Welcome to the Cumulus Support forum.

Latest Cumulus MX V4 release 4.0.1 (build 4023) - 16 May 2024

(Note that 4.1.0 (build 4024) - 05 June 2024 remains available, but usage of this version is not recommended - particularly for Davis stations - and the included utility in this distribution for migrating to v4 is known to contain errors affecting conversion of dayfile.txt)

Latest Cumulus MX V3 release 3.28.6 (build 3283) - 21 March 2024

Legacy Cumulus 1 release 1.9.4 (build 1099) - 28 November 2014
(a patch is available for 1.9.4 build 1099 that extends the date range of drop-down menus to 2030)

Download the Software (Cumulus MX / Cumulus 1 and other related items) from the Wiki

Validation Errors

Discussion of Ken True's web site templates

Moderator: saratogaWX

Post Reply
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Validation Errors

Post by William Grimsley »

Hi Ken/others,

I've put the word '&' into my URL but it's still not validating...

http://validator.w3.org/check?uri=http% ... co%2euk%2f

Please can someone help?

Thanks,

William
User avatar
saratogaWX
Posts: 1211
Joined: Wed 06 May 2009 5:02 am
Weather Station: Davis Vantage Pro Plus
Operating System: Windows 10 Professional
Location: Saratoga, CA, USA
Contact:

Re: Validation Errors

Post by saratogaWX »

You have now encountered the double-substitution issue with XML :)

In your flyout-menu.xml you have

Code: Select all

    <item caption="Met Office" link="http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&fcTime&=1366844400"/>
which I think should be

Code: Select all

    <item caption="Met Office" link="http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&fcTime=1366844400"/>
for the URL of

Code: Select all

http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&fcTime=1366844400
When the XML is read by the XML parser in PHP, it automatically does a replacement for & entities to just a '&' (likewise for < to '<' and > to '>'), so the URL string will result in

Code: Select all

http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&fcTime=1366844400
which contains the dreaded naked ampersands that the validator dislikes so much.

The trick is to double-encode each ampersand as '&amp;' to replace each '&' in the original URL in the XML.

The XML process will change the '&amp;' to '&amp' which will appear in the URL on the page, and the validator will be happy.

So.. the entry in your flyout-menu.xml should appear as

Code: Select all

    <item caption="Met Office" link="http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&amp;fcTime=1366844400"/>
User avatar
William Grimsley
Posts: 833
Joined: Thu 22 Sep 2011 5:22 pm
Weather Station: Davis Vantage Vue
Operating System: Windows 7 Home Premium 64-bit
Location: Latitude: 50.70189285 Longitude: -3.30849957
Contact:

Re: Validation Errors

Post by William Grimsley »

saratogaWX wrote:You have now encountered the double-substitution issue with XML :)

In your flyout-menu.xml you have

Code: Select all

    <item caption="Met Office" link="http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&fcTime&=1366844400"/>
which I think should be

Code: Select all

    <item caption="Met Office" link="http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&fcTime=1366844400"/>
for the URL of

Code: Select all

http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&fcTime=1366844400
When the XML is read by the XML parser in PHP, it automatically does a replacement for & entities to just a '&' (likewise for < to '<' and > to '>'), so the URL string will result in

Code: Select all

http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&fcTime=1366844400
which contains the dreaded naked ampersands that the validator dislikes so much.

The trick is to double-encode each ampersand as '&amp;' to replace each '&' in the original URL in the XML.

The XML process will change the '&amp;' to '&amp' which will appear in the URL on the page, and the validator will be happy.

So.. the entry in your flyout-menu.xml should appear as

Code: Select all

    <item caption="Met Office" link="http://www.metoffice.gov.uk/public/weather/forecast/fernwood-ottery-st-mary#?tab=fiveDay&amp;fcTime=1366844400"/>
Hi Ken! :D

Nice to see you reply! I haven't spoken to you in a long time! :lol:

That fix did the trick! I've never come across ampersands in XML before, so I didn't know what to do! I just thought it was correct from previous ampersands in normal HTML/PHP code. :lol:

Thanks again,

William
Post Reply