Leading Spaces for NMTOKENs Do Not Produce an Error in oXyge

Having trouble installing Oxygen? Got a bug to report? Post it all here.
KatK
Posts: 4
Joined: Wed Dec 22, 2004 6:53 pm

Leading Spaces for NMTOKENs Do Not Produce an Error in oXyge

Post by KatK »

I was validating a file that had a leading space in an attribute value that was typed as "NMTOKEN". The NMTOKENs are not to contain any spaces, yet oXygen does not report an error if it contains either a leading or trailing space. Even the pop-up documentation for it says "they can not contain spaces".

How do I get oXygen to validate this correctly? Or is this a bug? I'm using oXygen v11.2.

Here's a screen shot:
Image

Any help is most appreciated!
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Leading Spaces for NMTOKENs Do Not Produce an Error in oXyge

Post by george »

Hello,

The whitespace facet for NMTOKEN is collapse and thus the leading and trailing spaces are removed before validation:
http://www.w3.org/TR/xmlschema-2/#rf-whiteSpace

Best Regards,
George
George Cristian Bina
KatK
Posts: 4
Joined: Wed Dec 22, 2004 6:53 pm

Re: Leading Spaces for NMTOKENs Do Not Produce an Error in oXyge

Post by KatK »

But... whitespace in the middle of text produces an error; it doesn't appear to be "collapsed" before validation, so why wouldn't the parser then produce a validation error when the space is either the first or last character of the attribute value as well?
george
Site Admin
Posts: 2095
Joined: Thu Jan 09, 2003 2:58 pm

Re: Leading Spaces for NMTOKENs Do Not Produce an Error in oXyge

Post by george »

Check the definition for collapse:

collapse
After the processing implied by replace, contiguous sequences of #x20's are collapsed to a single #x20, and leading and trailing #x20's are removed.

That means the whitespace at the beginning and at the end is removed while for the one in the middle remains a single space character for each continuous block of whitespace.

Best Regards,
George
George Cristian Bina
Post Reply