Why do I get errors for multiple @xmlns on /html element?

Questions about XML that are not covered by the other forums should go here.
Zearin
Posts: 107
Joined: Mon Jul 30, 2007 11:31 pm
Location: College Park, MD, United States

Why do I get errors for multiple @xmlns on /html element?

Post by Zearin »

So, I've got the following:

Code: Select all


<html 
xmlns="http://www.w3.org/1999/xhtml"
xmlns:doap="http://usefulinc.com/ns/doap#"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:xf="http://www.w3.org/2002/xforms"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
…and so on and so forth. But for every @xmlns except the default (XHTML), I'm getting the following error:
E [Xerces] Attribute "xmlns:rdf" must be declared for element type "html".
The same error for every namespace prefix in the list. I've just listed the RDF error for brevity.

Why is this?

I haven't really used multiple @xmlns on an XHTML document before, so I'm not sure where to go from here. I'm currently using a 1.0 Strict DocType.
-- Zearin
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

The XHTML 1.0 Strict DTD allows only the first xmlns attribute that you used:

Code: Select all


<!ATTLIST html
%i18n;
id ID #IMPLIED
xmlns %URI; #FIXED 'http://www.w3.org/1999/xhtml'
>
You can modify the XHTML DTD or you can use one of the Relax NG equivalents of the XHTML DTDs available in [oXygen-install-folder]/frameworks/xhtml/relaxng: xhtml.rng, xhtml-basic.rng, xhtml-strict.rng. You associate a schema with the edited document by applying the action Associate Schema available on the toolbar Document and the menu Document -> XML Document.


Regards,
Sorin
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

I'm getting similar errors.

Here are the first few lines of my document:

Code: Select all

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:owl="http://www.w3.org/2002/07/owl#" xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"
xmlns:dc="http://purl.org/dc/elements/1.1/">
<head>
<meta http-equiv="Content-Type" content="application/xhtml+xml; charset=UTF-8"/>
<title>foo</title>
</head>
I'm getting the following errors in Oxygen when I attempt to validate the document:

Attribute "xmlns:rdf" must be declared for element type "html".
Attribute "xmlns:owl" must be declared for element type "html".
Attribute "xmlns:rdfs" must be declared for element type "html".
Attribute "xmlns:dc" must be declared for element type "html".

I'd be glad of any insights anyone can offer!

Many thanks,

Sam
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sorin_ristache »

Hello,
sampablokuper wrote:I'm getting the following errors in Oxygen when I attempt to validate the document:

Attribute "xmlns:rdf" must be declared for element type "html".
Attribute "xmlns:owl" must be declared for element type "html".
Attribute "xmlns:rdfs" must be declared for element type "html".
Attribute "xmlns:dc" must be declared for element type "html".

I'd be glad of any insights anyone can offer!

Many thanks,

Sam
The declarations of the namespace prefixes are reported as validation errors because the XHTML DTD specified in your XML document (xhtml-rdfa-1.dtd) and used for validating your document does not allow these declarations on the root element html. In the case of DTD the namespace declarations allowed on an element are strictly controlled by the DTD.

In the case of an XML Schema used for validating a document you can insert any namespace declaration on an element. You should consider using an XML Schema instead of a DTD.


Regards,
Sorin
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

Dear Sorin,

Thanks for your quick reply. It seems that Oxygen's validator works differently to the W3C's validator. For instance, the following RDFa document (copied from Wikipedia):

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<head>
<title>John's Home Page</title>
<base href="http://example.org/john-d/"/>
<meta property="dc:creator" content="Jonathan Doe"/>
</head>
<body>
<h1>John's Home Page</h1>
<p>My name is <span property="foaf:nick">John D</span> and I like <a
href="http://www.neubauten.org/" rel="foaf:interest" xml:lang="de">Einstürzende
Neubauten</a>.</p>
<p>My <span rel="foaf:interest" resource="urn:ISBN:0752820907">favorite book</span> is the
inspiring <span about="urn:ISBN:0752820907"><cite property="dc:title">Weaving the
Web</cite> by <span property="dc:creator">Tim Berners-Lee</span></span>.</p>
</body>
</html>
is declared valid by the W3C validator whereas Oxygen's response to it is:

Attribute "xmlns:foaf" must be declared for element type "html".
Attribute "xmlns:dc" must be declared for element type "html".

My guess is that Oxygen may need to be updated so that it is capable of handling RDFa documents. Alternatively, there is something wrong with the W3C validator, but that seems unlikely.

I would glad to know your thoughts,

Sam
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by george »

Hi Sam,

oXygen performs a validation of that document against the specified DTD. That is not valid for sure as the referred DTD does not define the xmlns:dc and xmlns:foaf as attributes of the html element. Sure, these are namespace declarations but DTDs are not namespace aware and the namespace declarations need to be defined inside the DTD as normal attributes.

I do not know what the W3C validator does exactly but it does not check the file against the http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd DTD.

For example, if you validate the file with oXygen using the External Validation action and you specify the http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd schema in the XML Schema tab then oXygen will report that the document is valid against this schema. You can eventually make the association inside the document like below:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xml:lang="en">
<head>
<title>John's Home Page</title>
<base href="http://example.org/john-d/" />
<meta property="dc:creator" content="Jonathan Doe" />
</head>
<body>
<h1>John's Home Page</h1>
<p>My name is <span property="foaf:nick">John D</span> and I like
<a href="http://www.neubauten.org/" rel="foaf:interest"
xml:lang="de">Einstürzende Neubauten</a>.</p>
<p>My <span rel="foaf:interest" resource="urn:ISBN:0752820907">favorite
book</span> is the inspiring <span about="urn:ISBN:0752820907"><cite
property="dc:title">Weaving the Web</cite> by
<span property="dc:creator">Tim Berners-Lee</span></span>.</p>
</body>
</html>
If you want to stay with the DTD then you can define the two namespace declarations inside the internal subset like below:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd"[
<!ATTLIST html xmlns:foaf CDATA #IMPLIED>
<!ATTLIST html xmlns:dc CDATA #IMPLIED>
]>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:foaf="http://xmlns.com/foaf/0.1/"
xmlns:dc="http://purl.org/dc/elements/1.1/" xml:lang="en">
<head>
<title>John's Home Page</title>
<base href="http://example.org/john-d/" />
<meta property="dc:creator" content="Jonathan Doe" />
</head>
<body>
<h1>John's Home Page</h1>
<p>My name is <span property="foaf:nick">John D</span> and I like
<a href="http://www.neubauten.org/" rel="foaf:interest"
xml:lang="de">Einstürzende Neubauten</a>.</p>
<p>My <span rel="foaf:interest" resource="urn:ISBN:0752820907">favorite
book</span> is the inspiring <span about="urn:ISBN:0752820907"><cite
property="dc:title">Weaving the Web</cite> by
<span property="dc:creator">Tim Berners-Lee</span></span>.</p>
</body>
</html>
and then the document will be valid against the DTD.

Best Regards,
George
George Cristian Bina
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

Dear George,

Thanks for your reply. This is extremely helpful! :D

The only issue I'm now faced with - and it's a nice problem to have! - is that I'm now spoiled for choice! :) If you or anyone else has any thoughts about the pros and cons of the two valid methods, I'd be grateful to know them.

Many thanks,

Sam
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by george »

Hi Sam,

I would go with a schema (XML Schema or Relax NG) simply because DTDs are not namespace aware and the RDFa needs namespaces.

Best Regards,
George
George Cristian Bina
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

george wrote: I would go with a schema (XML Schema or Relax NG) simply because DTDs are not namespace aware and the RDFa needs namespaces.
Thanks George,

In addition to your suggestion above, I found that the DTD version didn't render properly in all browsers. XSD version it is, then! (NB. I haven't tried Relax NG for this, because I'm working in a situation where I'm trying to keep the number of schema formats to a minimum - but thanks for suggesting Relax NG as another option.)

Many thanks,

Sam
kennedyzor
Posts: 1
Joined: Thu Dec 11, 2008 7:24 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by kennedyzor »

Hi george

Hello i'm new to this forum and i'll know about DTD & RDF. Could tell something about DTD & RDF ?

Thanks in advance.....

data conversion services india
aliman
Posts: 1
Joined: Mon Dec 15, 2008 2:22 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by aliman »

Hi folks, thanks for this thread, really helpful.

I hit a couple of problems.

I tried using the implied attribute list with the DTD validation. That worked fine with Oxygen, but when I passed the document to the W3C validator it failed to recognise the document type correctly (it tried to validate as XHTML 1.0 transitional).

I then tried associating the XML schema, but got a really wierd validation error regarding the script tag and a complaint about an xml:space attribute that isn't there.

Here's my code...

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd"
xmlns:con="http://www.w3.org/2000/10/swap/pim/contact#"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:rec="http://www.w3.org/2001/02pd/rec54#"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:mat="http://www.w3.org/2002/05/matrix/vocab#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:doc="http://www.w3.org/2000/10/swap/pim/doc#"
xmlns:org="http://www.w3.org/2001/04/roadmap/org#">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>SKOS Simple Knowledge Organisation System Reference, Editors' Draft
1 October 2008 $Revision: 1.38 $</title>
<meta name="generator" content="Amaya 9.54, see http://www.w3.org/Amaya/" />
<link href="extras.css" rel="stylesheet" type="text/css" />
<link href="http://www.w3.org/StyleSheets/TR/base" rel="stylesheet"
type="text/css" />
<script type="text/javascript" src="extras.js"></script>
</head>
Here's the validation error, which occurs at the script tag...

Code: Select all


Severity and Description	Path	Resource	Location	Creation Time	Id
[Xerces] cvc-complex-type.3.2.2: Attribute 'xml:space' is not allowed to appear in element 'script'.
@see: http://www.w3.org/TR/xmlschema-1/#cvc-complex-type w3c_WWW_2006_07_SWD_SKOS/reference/20081001 Overview.html line 23 1229340320526 28150
Any help appreciated.
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by george »

If you have both a DTD specified and a schema oXygen will validate by default against the schema. That can be controlled from Options->Preferences -- XML / XML Parser -- XML Parser Properties -- "Ignore the DTD for validation if a schema is specified". However, the DTD is still used and the default attributes as specified in the DTD appear in the document before that is validated against the specified schema.

For instance if you remove the schemaLocation attribute and use the "Show definition" action from the contextual menu on the script element then oXygen will open the DTD module that defines the script element. That is
http://www.w3.org/MarkUp/DTD/xhtml-script-1.mod
and the relevant part is

Code: Select all


<!ENTITY % script.attlist  "INCLUDE" >
<![%script.attlist;[
<!ATTLIST %script.qname;
%XHTML.xmlns.attrib;
%id.attrib;
xml:space ( preserve ) #FIXED 'preserve'
charset %Charset.datatype; #IMPLIED
type %ContentType.datatype; #REQUIRED
src %URI.datatype; #IMPLIED
defer ( defer ) #IMPLIED
>
<!-- end of script.attlist -->]]>
You can remove the DOCTYPE declaration and the xml:space will not be added automatically anymore. For example the following file is valid against the schema:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN"
"http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">-->
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd"
xmlns:con="http://www.w3.org/2000/10/swap/pim/contact#"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:rec="http://www.w3.org/2001/02pd/rec54#"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:mat="http://www.w3.org/2002/05/matrix/vocab#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:doc="http://www.w3.org/2000/10/swap/pim/doc#"
xmlns:org="http://www.w3.org/2001/04/roadmap/org#">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>SKOS Simple Knowledge Organisation System Reference, Editors' Draft
1 October 2008 $Revision: 1.38 $</title>
<meta name="generator" content="Amaya 9.54, see http://www.w3.org/Amaya/" />
<link href="extras.css" rel="stylesheet" type="text/css" />
<link href="http://www.w3.org/StyleSheets/TR/base" rel="stylesheet"
type="text/css" />
<script type="text/javascript" src="extras.js"></script>
</head>
<body>
</body>
</html>
Best Regards,
George
George Cristian Bina
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

It seems to be impossible to satisfy both the W3C validator and Oxygen's validator.

If the doctype is left in, Oxygen declares the document invalid (see Aliman's post) with the error, "Attribute 'xml:space' is not allowed to appear in element 'script'."

But if I apply the workaround you suggested - commenting out the doctype - then although Oxygen declares the file valid, the W3C validator declares it invalid and gives me the following error:

"No DOCTYPE found! Checking with default XHTML 1.0 Transitional Document Type."

Is there a solution - or maybe more than one solution - that will satisfy both validators?

If not, which validator is the best one to heed, and why? Also, if the W3C's validator is at fault and/or the XHTML+RDFa specs result in invalid XML, has anyone from Oxygen raised the matter with the W3C (e.g. filing a bug, etc)?

Many thanks indeed for all the help you've provided so far!
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

Hmm, I just noticed that opening http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd in Oxygen lists a lot of errors along the lines "src-resolve: Cannot resolve the name 'xhtml.dir.attrib' to a(n) 'attribute group' component."

Could this (i.e. faults in http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd) have anything to do with the problems we're encountering? Or am I barking up the wrong tree?

Thanks,

Sam
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

George wrote:
If you have both a DTD specified and a schema oXygen will validate by default against the schema. That can be controlled from Options->Preferences -- XML / XML Parser -- XML Parser Properties -- "Ignore the DTD for validation if a schema is specified". However, the DTD is still used and the default attributes as specified in the DTD appear in the document before that is validated against the specified schema.
This seems like a bug in Oxygen. Am I right about this? In other words, if the "Ignore the DTD for validation if a schema is specified" checkbox is ticked, then Oxygen should not use the DTD, and therefore it should not find the entry in http://www.w3.org/MarkUp/DTD/xhtml-script-1.mod that assigns an xml:space attribute to the <script> element. And if it doesn't find that entry, then Aliman's document should validate, right (assuming it's extended with a valid body and closing html tag)?

Basically, I'm trying to work out what's at fault here. Is it the XHTML code that Aliman and I have been trying to write, or is it the validator(s), or is it the XHTML+RDFa spec, or even some combination of these?

All I want is to be able to write an XHTML+RDFa document that:
  • validates in Oxygen, and
  • validates in the W3C validator, and
  • is capable of containing <style> and <script> elements and any other valid XHTML Strict elements (and, for that matter, XHTML Strict entities).
Is that too much to ask? :(

Sorry for expressing my frustration so frankly, but as you can see, I've been spending quite a bit of time on this!

Thanks again for all the help so far,

Sam
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by george »

Hi,

The W3C Validator is an application. That tries to detect automatically the document type and in some cases it fails. But you have the option to specifically test a document against a document type that you choose, just click on More Options and then select in the Use Doctype combo box XHTML+RDFa. If you do that with the document from this post topic has the DOCTYPE declaration commented then you will get that passing the validation.

oXygen is also an application and it allows you to validate documents against XML Schema, DTD or other type of schemas. By default the engine used for validating against XML Schema for example is Xerces but you can change that to Saxon SA or other engine. It is not a but as the DTD information is used when you specify to prefer a schema for validation even if a DTD is specified. This is how it was designed to work to allow for example using entities with other schema languages. The validation results depend on the schema or DTD that is used. In this topic the DTD and the schema are not synchronized.

Hope that helps,
George
George Cristian Bina
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

george wrote: The W3C Validator is an application. That tries to detect automatically the document type and in some cases it fails. But you have the option to specifically test a document against a document type that you choose, just click on More Options and then select in the Use Doctype combo box XHTML+RDFa. If you do that with the document from this post topic has the DOCTYPE declaration commented then you will get that passing the validation.
Right, but if I select XHTML+RDFa in the Doctype combo box, this just adds a doctype line to the file and validates the result (which is something Oxygen won't validate). For instance, if I paste the last example you gave into the W3C validator and override the doctype, the result is this:

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<!--<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML+RDFa 1.0//EN" "http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd">
<html xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.w3.org/1999/xhtml http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd"
xmlns:con="http://www.w3.org/2000/10/swap/pim/contact#"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:rec="http://www.w3.org/2001/02pd/rec54#"
xmlns:dct="http://purl.org/dc/terms/"
xmlns:mat="http://www.w3.org/2002/05/matrix/vocab#"
xmlns:xsd="http://www.w3.org/2001/XMLSchema#"
xmlns:owl="http://www.w3.org/2002/07/owl#"
xmlns:doc="http://www.w3.org/2000/10/swap/pim/doc#"
xmlns:org="http://www.w3.org/2001/04/roadmap/org#">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<title>SKOS Simple Knowledge Organisation System Reference, Editors' Draft
1 October 2008 $Revision: 1.38 $</title>
<meta name="generator" content="Amaya 9.54, see http://www.w3.org/Amaya/" />
<link href="extras.css" rel="stylesheet" type="text/css" />
<link href="http://www.w3.org/StyleSheets/TR/base" rel="stylesheet"
type="text/css" />
<script type="text/javascript" src="extras.js"></script>
</head>
<body>
</body>
</html>
which Oxygen does not consider valid due to the xml:space issue mentioned earlier in this thread. Even the W3C validator isn't totally happy: it generates the warning: 'The DOCTYPE Declaration for "XHTML + RDFa" has been inserted at the start of the document, but even if no errors are shown below the document will not be Valid until you add the new DOCTYPE Declaration.'

As far as I can tell, this is due to the W3C validator implementing an out-of-date draft of the RDFa in XHTML syntax spec, which required the presence of a doctype. The latest version does not require a doctype to be present, and the sample document presented (shown below) is not validated by the W3C validator unless the XHTML+RDFa doctype override is selected, much as was the case for your sample document.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml"
version="XHTML+RDFa 1.0"
xml:lang="en">
<head>
<title>Virtual Library</title>
</head>
<body>
<p>Moved to <a href="http://example.org/">example.org</a>.</p>
</body>
</html>
So w.r.t the latest draft, you were quite right about commenting out the doctype; w.r.t. the older one, you weren't, and it wasn't until I noticed the change in the draft that I realised what was going on.
Thank you for giving me the most up-to-date solution :)
george wrote: oXygen is also an application and it allows you to validate documents against XML Schema, DTD or other type of schemas. By default the engine used for validating against XML Schema for example is Xerces but you can change that to Saxon SA or other engine.
Just to check my understanding: all of these should conclude with the same result as each other, though, shouldn't they? I realise that Saxon SA might be faster, but the outcome should be the same, shouldn't it, unless one of the engines has a bug? (I don't have a license for Saxon SA though, so I can't test this.)
george wrote: It is not a but as the DTD information is used when you specify to prefer a schema for validation even if a DTD is specified. This is how it was designed to work to allow for example using entities with other schema languages. The validation results depend on the schema or DTD that is used. In this topic the DTD and the schema are not synchronized.
I'm afraid I don't understand this. If selecting the "Ignore the DTD for validation if a schema is specified" is supposed to make Oxygen ignore validation information in the DTD and use it for entity specifications only, then why is Oxygen still objecting to the presence of xml:space attributes in script elements? Surely the relevant part of http://www.w3.org/MarkUp/DTD/xhtml-script-1.mod (which is linked from http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd) counts as validation information that should be ignored?

That is to say, I realise that http://www.w3.org/MarkUp/DTD/xhtml-rdfa-1.dtd and http://www.w3.org/MarkUp/SCHEMA/xhtml-rdfa-1.xsd are not synchronized exactly, but surely ticking the "Ignore the DTD for validation if a schema is specified" checkbox should overcome this problem.

If it did, then I could create a document that would validate in both the W3C validator (as it stands) and in Oxygen, which would mean I'd benefit from Oxygen's validation while I'm developing my code, and my site's users could check my code's validity (against the older standard) by way of "validation" buttons on my site. Until the W3C updates its validator, that would be the best of both worlds :)

Again, many thanks indeed for the help!

Sam
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by george »

Please note that oXygen version 10 includes a licensed Saxon SA so you can use that from oXygen without the need for an additional license.

Different engines may give different results - in some cases due to bugs, in other cases due to different interpretations of the specification. Different applications may give different results because different engines give different results or because an application can process differently or apply different validations to a file. As in this topic when you probably validate against a DTD with the W3C Validator and with oXygen you validate against a schema (and that schema that matches a different set of documents than the DTD).

No, "Ignore the DTD for validation if a schema is specified" just removes the DTD Validator but all other DTD processing takes place and that includes entities handling and default values. For example, DTDs are not namespace aware, the namespace declarations are just attributes for a DTD and you can have such declarations defined as defaults in the DTD. If the DTD information will be completely ignored then the document can be not namespace wellformed.

<test>
<x:sample/>
</test>

with a DTD that defines xmlns:x as attribute on x:sample with a default value of http://www.example.com/sample. If you parse that without the DTD then you will have a not wellformed document, that is not XML.

What you can do however is to use an XML catalog and map the DTD to a local copy that can be just a dummy DTD (even an empty file will work I believe). Then oXygen will validate against the schema, will read also the DTD but as that does not contain any defaults the validation against the schema will work.

Best Regards,
George
George Cristian Bina
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

george wrote:Please note that oXygen version 10 includes a licensed Saxon SA so you can use that from oXygen without the need for an additional license.
I'm still using 9.3, but I'll look into getting a license for 10. Thanks for the tip.
george wrote:What you can do however is to use an XML catalog and map the DTD to a local copy that can be just a dummy DTD (even an empty file will work I believe). Then oXygen will validate against the schema, will read also the DTD but as that does not contain any defaults the validation against the schema will work.
Ah, that's a crafty workaround. I'll give that a try when I have time.

Thanks again,

Sam
halindrome
Posts: 1
Joined: Thu Jan 08, 2009 5:11 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by halindrome »

I am the principle maintainer of the XHTML Family DTDs and Schema at the W3C. Let me see if I can shed a little light here.

The W3C Validator uses the DTD implementations to validate documents. That validator has been enhanced to ignore warnings about xmlns: attributes. While those warnings are strictly correct (the DTD does not declare the attributes with those names) the warnings are useless and INCORRECT when namespace support is required. Since all XHTML family markup languages require namespace support, it seemed logical to update the validator to also have this support - albeit in a hackish manner. My recommendation would be that Oxygen implement a similar strategy.

W.r.t. xml:space, all XHTML family markup languages are required to have xml:space set to "preserve" on all elements. See XHTML Modularization section 3.5 clause 8, and Appendix I. The xml:space attribute defines how an XML processor treats data on input. XHTML requires that the data is preserved intact and passed to the underlying application for further processing. I believe that any discrepancy with regard to xml:space treatment is a red herring - there is no conflict here. If there are errors in my implementation of the DTD or Schema, please let me know via mail to www-html-editor@w3.org so we can address them formally.
sampablokuper
Posts: 22
Joined: Tue Apr 08, 2008 1:41 pm

Re: Why do I get errors for multiple @xmlns on /html element?

Post by sampablokuper »

Readers of this forum may also wish to view the mailing list thread on the issue, which begins here.
Post Reply