WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#17826 closed defect (bug) (invalid)

Problem with the XML namespace feature

Reported by: html5rules Owned by: Sohail Amir
Milestone: Priority: normal
Severity: major Version: 3.1.3
Component: General Keywords:
Focuses: Cc:

Description

Hi,

I have raised this issue over at the WordPress forums but no one is able to help and suggested that I bring up the bug here. Please find the details at http://wordpress.org/support/topic/html5-lang-attribute-problems as it's a bit complicated but definitely something that should be looked at when WordPress is ready for HTML5. I don't understand why 2 different sets of code are being generated for different websites. I'm not sure if this is a bug, but it is vital for some users to have valid code; even if HTML5 is experimental. It either needs patching, or needs documentation because on the documentation site it says we don't need to know about XML namespace which is a bit biased.

Regards,

Sohail

Change History (7)

comment:1 ocean903 years ago

I don't know where it comes from, but WordPress shouldn't add it, see #14226.

comment:2 ericmann3 years ago

It's not. Poking at the site and viewing it through the validator shows a major discrepancy:

  • Visiting it in a browser (the live version) is dynamic and includes just <html> in the header.
  • Visiting it through the validator returns a document from W3CTC instead that has <html lang="en" xmlns="http://www.w3.org/1999/xhtml"> in the header.

comment:3 html5rules3 years ago

Eric, the cache is not the problem, when I remove the 'lang' attribute and flush the cache it is removed according to http://achecker.ca/checker/ but the XML namespace is still there.

comment:4 ericmann3 years ago

When I visit your homepage I see <html lang="em"> in the header and it's served normally. When the validator visits your homepage, it sees <html xmlns="http://www.w3.org/1999/xhtml"> and is served from your CDN.

I suspect you have something else on your server that is sending files from different locations. Case in point:

From your "live" site:

<head>
<meta charset="UTF-8" />
<meta name="google-site-verification" content="atYObw1ps1-mPKqYv4Tx8X_BS8kaSKZSP_SWGZCRGSk" />
<title>SohailTech | Freelance Web Design</title>
<link rel="stylesheet" href="/wp-content/themes/sohailtech/style.css" />
<link rel="pingback" href="http://www.sohailtech.com/xmlrpc.php" />
<link rel="shortcut icon" href="http://www.sohailtech.com/favicon.ico" />

From the validator:

<head>
<link rel="stylesheet" type="text/css" href="http://cdn.sohailtech.com/wp-content/w3tc/min/ef9da2143ea4f0dd5dbd01943621f6b0.2206335831.css" media="all" />
<meta charset="UTF-8" />
<meta name="google-site-verification" content="atYObw1ps1-mPKqYv4Tx8X_BS8kaSKZSP_SWGZCRGSk" />
<title>SohailTech | Freelance Web Design</title>
<link rel="pingback" href="http://www.sohailtech.com/xmlrpc.php" />
<link rel="shortcut icon" href="http://cdn.sohailtech.com/favicon.ico" />

Your server is responding differently to different requests. For a live request it's returning regular content. For the request from the validator it's returning content from a CDN. This isn't a WordPress issue.

comment:5 follow-up: html5rules3 years ago

Hi,

Thanks for your responses, OK according to http://codex.wordpress.org/HTML_to_XHTML -

You don't need to understand the "XML namespace" attribute, except to know that it is required in all XHTML documents. Here is an example of how to write it:

<html xmlns="http://www.w3.org/1999/xhtml">

I can see the stylesheet is being served by the CDN, it only does that for the images and sometimes the stylesheet the plugin doesn't really work well for me so that's a separate issue I need to address. How can you tell the actual document is being served by the CDN?

I've tried disabling that plugin which had the same results and I don't think the hosting has anything to do with changing the coding in my files. It could have something to do with a plugin or just a bug but I have no idea what plugin or feature would require the XML namespace when the documentation doesn't even explain what it does. In any case the team should update the documentation from what you've read above.

comment:6 in reply to: ↑ 5 ericmann3 years ago

I can see the stylesheet is being served by the CDN, it only does that for the images and sometimes the stylesheet the plugin doesn't really work well for me so that's a separate issue I need to address. How can you tell the actual document is being served by the CDN?

The fact of the matter is that your server is responding different based on whether I visit the site in a browser or the validator visits it using a separate tool. WordPress doesn't serve different content for different user agents, that's something that your system has configured separately.

The message at the bottom of the file actually explains that the server replaced your stylesheet with one served from the CDN. If it's doing that, then it can replace your <html> tag as well. So first thing's first, you need to turn off whatever you have running that's dynamically re-serving your content.

True, I don't see the CDN version in the browser, but the IDI Web Accessibility Checker does. If you've got your CDN code completely disabled and they're still showing it, then it means they are also caching the request. Either way, it's not WordPress and not a bug.

comment:7 scribu3 years ago

  • Keywords needs-patch needs-docs removed
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

This discussion should be continued in the support forums.

Note: See TracTickets for help on using tickets.