Validation Against DTD Fails For No Obvious Reason

Having trouble installing Oxygen? Got a bug to report? Post it all here.
drmacro
Posts: 10
Joined: Fri Jul 16, 2004 11:25 pm

Validation Against DTD Fails For No Obvious Reason

Post by drmacro »

When I open documents with DOCTYPE declarations and external DTD subsets, when I validate I consistently get this type of response:

http://www.w3.org/TR/xmlschema-1/#cvc-elt E cvc-elt.1: Cannot find the declaration of element 'user_guide'. symbian_help_test_en_2.xml file:/C:/users/MODEClient/eliot/symbian_help_test/en/issue_2/symbian_help_test_en_2.xml 4:1

The document in question is unquestionably valid (I can validate it with any number of tools) and tagsense appears to work (insertion only shows elements that are actually valid at a particular location--I don't think that's just learning).

The doctype declaration has this form:

<!DOCTYPE user_guide SYSTEM "../../../dtds/mode_userguide/mode_userguide.dtd">

And I can do "open file at cursor" and the mode_userguide.dtd file opens. I am not using catalogs (all external entities are referenced via relative URIs and all dependencies are present).

I'm getting this behavior with several doctypes, including custom ones and the DocBook XML DTD.

Any idea what might be causing this or how I can debug it?

Thanks,

Eliot
----
Eliot Kimber
Innodata Isogen
drmacro
Posts: 10
Joined: Fri Jul 16, 2004 11:25 pm

Post by drmacro »

This behavior is seen with 4.1 and the very latest 4.2 versions.
----
Eliot Kimber
Innodata Isogen
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Validation Against DTD Fails For No Obvious Reason

Post by george »

Dear Eliot,
drmacro wrote:http://www.w3.org/TR/xmlschema-1/#cvc-elt E cvc-elt.1: Cannot find the declaration of element 'user_guide'. symbian_help_test_en_2.xml file:/C:/users/MODEClient/eliot/symbian_help_test/en/issue_2/symbian_help_test_en_2.xml 4:1
This error is specific to schema validation. In oXygen there is a feature we added to allow both external entities and XML Schema validation to go together: Options->Preferences->XML->XML Parser options->Use XML Schema for validation. When this feature is enabled oXygen will disregard the DTD declaration and will always try to validate the document against an XML Schema. I think that you have this feature enabled and that is why you are getting these errors.

Best Regards,
George
drmacro
Posts: 10
Joined: Fri Jul 16, 2004 11:25 pm

Post by drmacro »

You are correct--I changed the settings and DTD validation worked (almost).

However, my expectation would be that if a document neither specifies xsi:schemaLocation nor has an explicilty-associated schema but does have a DOCTYPE declaration, that the DOCTYPE would be used. It's certainly incovenient to have to change this setting, which requires restarting the editor, just to work on documents that do and do not use schemas.

Also, it appears that, at least by default, oXygen is using a non-conforming parser that does not respect namespace declarations that are declared in fixed attributes in the DTD. I know this is an issue with MSXML and possibly other parsers. It is not an issue for Aelfred or Xerces.

I have not looked if there is a way to change the parser that oXygen is using (since it's Java-based, I'm assuming there is).

Cheers,

Eliot
----
Eliot Kimber
Innodata Isogen
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Post by george »

Hi Eliot,
drmacro wrote:However, my expectation would be that if a document neither specifies xsi:schemaLocation nor has an explicilty-associated schema but does have a DOCTYPE declaration, that the DOCTYPE would be used.
Your expectation is the default behavior of oXygen. There is however a possible situation when both schema and DTD are specified, in this case by default the DTD is used for validation. To get oXygen ignore the DTD for validation but get the DTD defined entities and validate against the specified schema one should enable the "Use XML Schema for validation" feature. This will turn off DTD validation completely.
drmacro wrote:It's certainly incovenient to have to change this setting, which requires restarting the editor, just to work on documents that do and do not use schemas.
See my comment above. An additional note is that there is no need to restart the editor when you change the "Use XML Schema for validation" flag. The restart is needed only for the "Enable XInclude processing" preference in that preferences dialog.
drmacro wrote: Also, it appears that, at least by default, oXygen is using a non-conforming parser that does not respect namespace declarations that are declared in fixed attributes in the DTD. I know this is an issue with MSXML and possibly other parsers. It is not an issue for Aelfred or Xerces.
You may consider posting the problem you have, FYI Oxygen uses Xerces 2.6.2, the latest Xerces release. Also DTDs are not namespace aware.
drmacro wrote: I have not looked if there is a way to change the parser that oXygen is using (since it's Java-based, I'm assuming there is).
You cannot change the parser used by oXygen, as I said above it is Xerces 2.6.2. It is possible however to use the External tools options to add a validation with a different parser as an external tool. I configured for instance Saxon 8SA to perfrom XML Schema validation on the current edited file as an external tool.

Best Regards,
George
Post Reply