Reputation: 653
I couldn't get my website to validate in W3C markup validation.
Here is an example of one of the validation errors.
Error: Attribute xmlns:content not allowed here.
I have done some research and some articles recommend us to change the:xmlns:name="http://url" syntax into the prefix="name:http://url"
However I am having multiple xmlns attribute.
Not sure how to write the prefix in this case.
Original:
`<html lang="en" dir="ltr"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:og="http://ogp.me/ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:sioct="http://rdfs.org/sioc/types#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">`
Is it separate by a space between each attribute?
<html lang="en" dir="ltr" prefix="content:http://purl.org/rss/1.0/modules/content/ dc:http://purl.org/dc/terms/ foaf:http://xmlns.com/foaf/0.1/">
or we should separate by \n
new line?
I have checked in w3.org website and it looks like they separate the attribute in new line.
Am I right?
http://www.w3.org/TR/2011/WD-rdfa-core-20111215/
Upvotes: 1
Views: 3346
Reputation: 166
You need a XHTML doctype to go before your html tag. You can use:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
And there must be xmlns="http://www.w3.org/1999/xhtml"
also on the html
tag. So this passes the W3C XHTML validation at https://validator.w3.org/ :
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en" dir="ltr"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:dc="http://purl.org/dc/terms/"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:og="http://ogp.me/ns#"
xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:sioc="http://rdfs.org/sioc/ns#"
xmlns:sioct="http://rdfs.org/sioc/types#"
xmlns:skos="http://www.w3.org/2004/02/skos/core#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#">
<head><title></title></head>
<body></body>
</html>
Upvotes: 0
Reputation: 5485
The Web page contains RDFa markup, which is allowed in HTML 5. The HTML+RDFa 1.1 specification has a section specifically dedicated to the @xmlns:
attributes.
It says that the use of @xmlns:
is deprecated in RDFa 1.1 but still allowed for backward compatibility. So, if possible, it should not be used. Then, the following section on Conformance Criteria for @xmlns:-Prefixed Attributes indicates that:
For documents conforming to this specification, attributes with names that have a case insensitive prefix matching "
@xmlns:
" MUST be considered conforming. Conformance checkers SHOULD accept attribute names that have a case insensitive prefix matching "@xmlns:
" as conforming. Conformance checkers SHOULD generate warnings noting that the use of@xmlns:
is deprecated. Conformance checkers MAY report the use ofxmlns:
as an error.
I understand that the W3C HTML validator is adopting the stricter conformance check where xmlns:
is reported as an error, although I find it strange because it SHOULD rather generate a warning.
Upvotes: 0
Reputation: 943556
You can't use elements from arbitrary namespaces in HTML 5. For that you need to be using XML, and for validation you need a suitable DTD or Schema that includes all the namespaces you want to use.
Upvotes: 1