Request for feedback on handling whitespace in XML notices #779
Replies: 1 comment 1 reply
-
First thanks for discussing this in advance! I fully support the proposed change. Your question 3 fits in the in the context of a short discussion I had with Karl about “not knowing what effect a new or changed rule might have” and “one year transition period might be very short if severe conflicts have to be solved” . Here I came up with the following proposal: Problem statement: Introducing new business rules or changed rules into the wild (defined as you do not know all systems depending on them) might have severe and unknown impact. At the same time nothing is a better test than the real-life in the wild. Solution idea: Introduce new schematron rules with a severity level which indicates that this rule will fire as an error or warning or whatsoever in the future. E.g. “future-error”
Another variant:
|
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
We are thinking about changing the way we handle whitespace inside XML elements when validating XML notices.
We would like to get your input on the topic before we go ahead with any change
Current situation
When a rule looks at the value of a field, any leading or trailing whitespace (space, tab, line break, etc.) are ignored.
That's done by using the
normalize-space
function in the XPath of the Schematron test.For example:
This means that all of the following 3 elements are considered OK for the above rule:
Problem
As described above, we currently accept notices in which elements that contain a structured string (like identifier or code from a codelist) have leading or trailing whitespace.
This can cause problems for applications that read values from the XML by themselves by just using the XPath of the field: they will get a value with leading and/or trailing whitespace.
Proposed change
For fields that correspond to a structured string (so field that have a type of "id", "id-ref", or "code"), we would add rules to check that their value do not have leading or trailing whitespace. In XPath it would be something like:
. = normalize-space(.)
This means that only the first element in the example above would be considered valid. A notice containing the second or third element would be rejected.
This would not impact "free text" fields (like title, description, etc.) or fields that have a type corresponding to a number or a date.
Questions
In order to help guide this change, we would like to have some input on the following questions
1/ When generating XML notices, how do handle whitespace in the values ?
2/ When reading data from XML notices, do you remove leading and trailing whitespace ?
3/ Would you be impacted if we added the rules described above ? How ?
Beta Was this translation helpful? Give feedback.
All reactions