Permalink
Browse files

Treat unsupported namespaces differently from unknown ones.

Add a specific warning for namespaces that are in use but unsupported
by the validator. Point to the specification.
  • Loading branch information...
1 parent aaf55a4 commit 921197340058e313a81b6e63c12dc00c8d33a7fb @josephw josephw committed Oct 4, 2012
@@ -0,0 +1,26 @@
+<fvdoc>
+<div xmlns='http://www.w3.org/1999/xhtml'>
+<div id='message'>
+<p>Unable to validate namespace: <code>http://namespace.uri/</code>. See the <i>foo</i> specification at <code>http://namespace.uri/specification</code></p>
+</div>
+<div id='explanation'>
+<p>Even though the feed validator has build in support for quite a
+<a href="../howto/declare_namespaces.html">large number</a>
+of popular namespaces, you somehow managed to have found one that the
+feed validator does not (yet) support.</p>
+</div>
+<div id='solution'>
+<p>The feed validator is unable to verify the correct usage of this namespace.
+Either it is not well-specified, there are no test cases to demonstrate
+correct use or it just hasn't been implemented.</p>
+<p>Please consult the specification for correct use of this namespace.</p>
+<p>If you know of a namespace that you feel that the feed validator should
+support, <a href="http://groups.google.com/group/feedvalidator-users">let us
+know</a>. Please include in your request a pointer to the documentation for
+the namespace. Such documentation should describe the XML elements and
+attributes defined for this namespace. More information and the status of
+current requests can be found on the <a
+href="http://code.google.com/p/feedvalidator/wiki/ExtensionNamespaces">wiki</a>.</p>
+</div>
+</div>
+</fvdoc>
View
@@ -295,6 +295,7 @@ <h3>Warnings</h3>
<li><a href="warning/UnknownNamespace.html">Use of unknown namespace: <code>http://namespace.uri/</code></a></li>
<li><a href="warning/UnregisteredAtomLinkRel.html">Unregistered <code>link</code> relationship: <code>foo</code></a></li>
<li><a href="warning/UnsupportedItunesFormat.html">Format <code>foo</code> is not supported by iTunes</a></li>
+<li><a href="warning/UnsupportedNamespace.html">Unable to validate namespace: <code>http://namespace.uri/</code>. See the <i>foo</i> specification at <code>http://namespace.uri/specification</code></a></li>
<li><a href="warning/UseOfExtensionAttr.html">Use of extension attribute on RSS 2.0 core element: <code>(namespace,name)</code></a></li>
<li><a href="warning/UseZeroForMidnight.html">Use zero for midnight</a></li>
</ul>
@@ -0,0 +1,83 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
+<head>
+<title>Unable to validate namespace: http://namespace.uri/. See the foo specification at http://namespace.uri/specification</title>
+<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
+<link rel="icon" href="http://www.feedvalidator.org/favicon.ico" />
+<link rel="shortcut icon" href="http://www.feedvalidator.org/favicon.ico" />
+<style type="text/css" media="screen">@import "../../css/common.css";
+@import "../../css/documentation.css";</style>
+<script type="text/javascript"><!-- --></script>
+<link rel="start" href="http://feedvalidator.org/docs/" title="Home" />
+</head>
+<body>
+<div id="logo">
+<h1><a href="../../"><span id="feed"><span id="f">F</span><span id="e1">E</span><span id="e2">E</span></span><span id="d">D</span> Validator</a></h1>
+<p>Documentation</p>
+<a class="skip" href="#startnavigation">Jump to navigation</a>
+</div> <!--logo-->
+
+<div id="main">
+<h2>Message</h2>
+<div class="docbody">
+<p>Unable to validate namespace: <code>http://namespace.uri/</code>. See the <i>foo</i> specification at <code>http://namespace.uri/specification</code></p>
+</div>
+<h2>Explanation</h2>
+
+<div class="docbody">
+<p>Even though the feed validator has build in support for quite a
+<a href="../howto/declare_namespaces.html">large number</a>
+of popular namespaces, you somehow managed to have found one that the
+feed validator does not (yet) support.</p>
+</div>
+<h2>Solution</h2>
+<div class="docbody">
+<p>The feed validator is unable to verify the correct usage of this namespace.
+Either it is not well-specified, there are no test cases to demonstrate
+correct use or it just hasn't been implemented.</p>
+<p>Please consult the specification for correct use of this namespace.</p>
+<p>If you know of a namespace that you feel that the feed validator should
+support, <a href="http://groups.google.com/group/feedvalidator-users">let us
+know</a>. Please include in your request a pointer to the documentation for
+the namespace. Such documentation should describe the XML elements and
+attributes defined for this namespace. More information and the status of
+current requests can be found on the <a
+href="http://code.google.com/p/feedvalidator/wiki/ExtensionNamespaces">wiki</a>.</p>
+</div>
+<h2>Not clear? Disagree?</h2>
+<div class="docbody">
+<p>You might be able to find help in one of <a href="../howto/resources.html">these fine resources</a>.</p>
+</div>
+
+</div><!--main-->
+<div class="centered">
+<a name="startnavigation" id="startnavigation"></a>
+<div class="navbarWrapper">
+ <div class="navbarContent">
+ <img class="borderTL" src="../../images/borderTL.gif" alt="" width="14" height="14" />
+ <img class="borderTR" src="../../images/borderTR.gif" alt="" width="14" height="14" />
+
+<p>
+<a href="../../">Home</a> &middot;
+<a href="../../about.html">About</a> &middot;
+<a href="../../news/">News</a> &middot;
+<a href="../../docs/">Docs</a> &middot;
+<a href="../../terms.html">Terms</a>
+</p>
+
+ <div class="roundedCornerSpacer">&nbsp;</div>
+ </div><!-- .content -->
+ <div class="bottomCorners">
+ <img class="borderBL" src="../../images/borderBL.gif" alt="" width="14" height="14" />
+ <img class="borderBR" src="../../images/borderBR.gif" alt="" width="14" height="14" />
+ </div><!-- .bottomCorners -->
+</div><!-- .contentWrapper -->
+</div><!-- .centered -->
+
+<div class="centered">
+<address>Copyright &copy; 2002-4 <a href="http://diveintomark.org/">Mark Pilgrim</a> and <a href="http://www.intertwingly.net/blog/">Sam Ruby</a></address>
+</div>
+
+</body>
+</html>
View
@@ -84,6 +84,11 @@
"xri://$xrds": "xrds",
}
+unsupported_namespaces = {
+ "http://schemas.google.com/g/2005": ("Google Data", "https://developers.google.com/gdata/docs/1.0/elements"),
+ "http://www.rawvoice.com/rawvoiceRssModule/": ("RawVoice", "http://www.rawvoice.com/services/tools-and-resources/rawvoice-rss-2-0-module-xmlns-namespace-rss2/")
+}
+
def near_miss(ns):
try:
return re.match(".*\w", ns).group().lower()
@@ -172,8 +177,13 @@ def startPrefixMapping(self, prefix, uri):
rule.setElement('xmlns:'+str(prefix), {}, self.handler_stack[-1][0])
rule.value=uri
if not uri or rule.validate():
- from logging import UnknownNamespace
- self.log(UnknownNamespace({'namespace':uri}))
+ if uri in unsupported_namespaces:
+ from logging import UnsupportedNamespace
+ (name, specification) = unsupported_namespaces[uri]
+ self.log(UnsupportedNamespace({'namespace': uri, 'name': name, 'specification': specification}))
+ else:
+ from logging import UnknownNamespace
+ self.log(UnknownNamespace({'namespace':uri}))
def namespaceFor(self, prefix):
return None
@@ -254,6 +254,7 @@
UseZeroForUnknown: "Use zero for unknown length",
UnknownHost: "Unknown host",
UnknownNamespace: "Use of unknown namespace: %(namespace)s",
+ UnsupportedNamespace: "Unable to validate namespace: %(namespace)s. See the %(name)s specification at %(specification)s",
IntegerOverflow: "%(element)s value too large",
InvalidNSS: "Invalid Namespace Specific String: %(element)s",
SinceAfterUntil: "Since After until",
@@ -246,6 +246,7 @@ class MisplacedXHTMLContent(Warning): pass
class SchemeNotIANARegistered(Warning): pass
class AvoidNamespacePrefix(Warning): pass
class UnknownNamespace(Warning): pass
+class UnsupportedNamespace(Warning): pass
class MissingRecommendedAttribute(Warning): pass
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+Description: Unsupported namespaces get a warning
+Expect: UnsupportedNamespace{namespace:http://schemas.google.com/g/2005}
+-->
+
+<feed xmlns="http://www.w3.org/2005/Atom"
+ xmlns:a="http://www.w3.org/2007/app">
+
+ <title>Example Feed</title>
+ <link href="http://example.org/"/>
+ <updated>2003-12-13T18:30:02Z</updated>
+ <author>
+ <name>John Doe</name>
+ <email xmlns='http://schemas.google.com/g/2005'>user@example.test</email>
+ </author>
+ <id>urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6</id>
+
+ <entry>
+ <title>Atom-Powered Robots Run Amok</title>
+ <link href="http://example.org/2003/12/13/atom03"/>
+ <id>urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a</id>
+ <updated>2003-12-13T18:30:02Z</updated>
+ <summary>Some text.</summary>
+ </entry>
+
+</feed>

0 comments on commit 9211973

Please sign in to comment.