White space entity is resolved when validating DTD but I wish it wouldn't

This should cover W3C XML Schema, Relax NG and DTD related problems.
maifosz
Posts: 1
Joined: Tue Apr 26, 2022 2:07 pm

White space entity is resolved when validating DTD but I wish it wouldn't

Post by maifosz »

When I validate an article against the JATS dtd in our validation service (JAVA, runs on a unix machine) that contains the following code:

Code: Select all

<mml:math><mml:mrow><mml:mi>k</mml:mi><mml:mo>&#x3d;</mml:mo><mml:mi>a</mml:mi>&#x20;<mml:mo>.</mml:mo><mml:msub><mml:mi>c</mml:mi><mml:mi>p</mml:mi></mml:msub><mml:mo>.</mml:mo><mml:mi>&#x3c1;</mml:mi></mml:mrow></mml:math>
I get this validation error:
The content of element type "mml:mrow" must match "(copyright-statement*,copyright-year*,copyright-holder*,license*)". Children of type "character reference" are not allowed.
This is triggered by the

Code: Select all

&#x20;
entity that is the direct child of the mml:mrow element.
However, when I validate it against the same dtd in Oxygen, I get no error. It seems like the entity is resolved as a 'whitespace' and ignored.
While I get that this is the correct behaviour :D I was wondering if there was a possibility to not resolve these whitespace entities so that we can replicate the behaviour of our server in Oxygen?

Thanks,
Zsofia
Radu
Posts: 9049
Joined: Fri Jul 09, 2004 5:18 pm

Re: White space entity is resolved when validating DTD but I wish it wouldn't

Post by Radu »

Hi Zsofia,

Validation of XML content against a schema/DTD is done on the resolved XML content which has already expanded the entity references to their text equivalents.
So Oxygen's behavior is correct and your server's validation service does not obey the XML specification.
https://www.w3.org/TR/xml/#include-if-valid
I'm afraid we do not have a setting to control this on Oxygen's side because our validation is correct.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply