Page 1 of 1

Leading Spaces for NMTOKENs Do Not Produce an Error in oXyge

Posted: Mon Jun 06, 2011 11:45 pm
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!

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

Posted: Tue Jun 07, 2011 9:52 am
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

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

Posted: Tue Jun 07, 2011 3:07 pm
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?

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

Posted: Tue Jun 07, 2011 5:37 pm
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