Issue Details (XML | Word | Printable)

Key: MDL-7883
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Minor Minor
Assignee: Martin Dougiamas
Reporter: Nick Freear
Votes: 0
Watchers: 0
Operations

Add/Edit UI Mockup to this issue
If you were logged in you would be able to see more operations.
Moodle

'application/xhtml' and XHTML Strict preferred, initially in debug mode

Created: 11/Dec/06 06:35 PM   Updated: 23/Apr/09 06:07 PM
Return to search
Component/s: General
Affects Version/s: 1.7
Fix Version/s: None

File Attachments: 1. File patch-06dec2006-strictxml-weblib_2.diff (4 kB)

Environment:
Components: Markup, Standards

Tests server variables: HTTP_ACCEPT, HTTP_USER_AGENT
Issue Links:
Dependency
 
Relates
 

Database: Any
Participants: Jeffrey Silverman, Jon Papaioannou, Martin Dougiamas and Nick Freear
Security Level: None
Resolved date: 12/Dec/06
Affected Branches: MOODLE_17_STABLE


 Description  « Hide
http://www.w3.org/TR/2002/NOTE-xhtml-media-types-20020801/

Just seen Bug MDL-7861 - I've been looking at something similar, initially for debugging. In DEBUG_DEVELOPER mode this patch delivers pages as the preferred 'application/xhtml+xml' mime-type to supporting browsers (Firefox, Opera, iCab... Safari issue with character entities, http://www.w3.org/2000/07/8378/xhtml/entities) and 'application/xml' for Win-IE 5+ (http://www.w3.org/MarkUp/2004/xhtml-faq#ie). Other browsers get 'text/html'.

An XML well-formed bug (stray &, unquoted attributes...) leads to an XHTML browser displaying an error message in place of the page, which should be useful for developers. (Note, an on/off switch may be useful to aid diagnosis.)

The patch also substitutes the XHTML Strict document-type declaration in DEBUG_NORMAL mode - note, error messages aren't displayed in the browser, a 3rd party validator is required.

 All   Comments   Change History   Version Control      Sort Order: Ascending order - Click to sort in descending order
Nick Freear made changes - 11/Dec/06 06:55 PM
Field Original Value New Value
Link This issue has been marked as being related by MDL-7861 [ MDL-7861 ]
Nick Freear added a comment - 11/Dec/06 07:33 PM
Already spotted markup errors (MDL-7884) using this patch! I await feedback with interest

Nick Freear made changes - 11/Dec/06 07:33 PM
Link This issue will help resolve MDL-7884 [ MDL-7884 ]
Martin Dougiamas added a comment - 12/Dec/06 02:54 PM
Looks really useful, thanks! I'll put this in HEAD right away.

Martin Dougiamas made changes - 12/Dec/06 03:31 PM
Assignee Nick Freear [ nfreear ] Martin Dougiamas [ dougiamas ]
Martin Dougiamas added a comment - 12/Dec/06 03:31 PM
I'll resolve this and we can log XHTML 1.0 strict fixes against MDL-7861

Martin Dougiamas made changes - 12/Dec/06 03:31 PM
Resolution Fixed [ 1 ]
Status Open [ 1 ] Resolved [ 5 ]
moodler committed 2 files to 'Moodle CVS' - 12/Dec/06 04:24 PM
Added changes suggested by Nick in MDL-7883 to help debug XHTML strict

It only affects DEBUG_DEVELOPER mode, and causes the browser to break when it encounters non-strict XHTML.

I took out the changes for DEBUG_NORMAL for now, might be premature.
MODIFY lib/weblib.php   Rev. 1.704    (+62 -5 lines)
ADD lib/xhtml.xsl   Rev. 1.1    (+0 -0 lines)
Jon Papaioannou added a comment - 24/May/07 09:21 PM
I 've just had an unpleasant encounter with this feature in the MOODLE_18_STABLE branch. It's true that there were compliance errors that have gone unnoticed so far (that's why it bit me right now) and possibly could continue to go unnoticed in the future.

That's how this feature is a good thing.

It's also a BAD thing in its own way though:

1. It caused me a "WHAT?!?! Is Moodle served as XML by default?!?!?!" panic moment.

For people who haven't read such discussions, the one-sentence summary is:
We will never be able to serve Moodle as an XML content-type, because the page could contain validation errors caused from user content (or from aggregated content) and the side effect (ugly error message, total shutdown) is unacceptable to the end user.

Sometimes you need to serve as XML (e.g. to use MathML), in which case you have to put up with this. But it's not doable in the general case. Please research the subject if you feel that I have not convinced you on the extent of the problem.

2. It forced me to find out why XML was being served and fix it on the spot, when I 'd much rather be doing what I originally set out to do.

So, considering that there are other good ways (FF's Web Dev Toolbar) to always catch validation errors, it might be a good idea to have a way to turn this feature off while keeping debugging on and still using FF.

Just my 2 cents.


Jeffrey Silverman added a comment - 23/Apr/09 06:07 PM
Now, some time later, my $0.02.

There should be some sort of warning in the admin page text for "xmlstrictheaders" setting that says "You WILL break your site!!"

It is very easy to completely disable a site by turning xmlstrictheaders on!

Also, it seems like that setting will apply only to debug mode, but, in fact, it stays on even when debug and debugdisplay are both 0.

This is as of Moodle 1.9.4+

Thanks!