We have some rules that use restrictValues. The values from XML files sometimes have whitespaces before and after the actual values. The actual values match with the value list provided to restrictValues but because of the whitespaces the rules are failing.
Is there a way to ignore the whitespaces?
Thank you.
Cristian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Cristian, I'm having a little difficult visualizing this - could you post just the sample restrictValues() rule to help? You can post it here - just hit TAB key at start of the line before inserting - that way it retains the code as is.
Thanks, David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
As you can see, between the tags there are some whitespaces (spaces, LineFeeds etc.).
If we manually remove the whitespaces (like this <biom:FingerprintImageImpressionCaptureCategoryCode>6</biom:FingerprintImageImpressionCaptureCategoryCode>) then the validation is ok.
Cristian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Cristian, strictly speaking according to the XML specification - those spaces are incorrect and it is an error to do that. Notice - persisting that data into a DB would cause similar issues (maybe worse!). BTAIM - here is the work-around using a conditional.
What this does is check condition="normalize-space( ./This) = ." so that the restrictValues is skipped when that's not true - but then - does an additional check that the length is 1 character.
Didn't know about the normalize-space test. I just checked the OASIS CAM specification v1.1 but it does not appear there.
Where can we found the documentation for all the functions and conditions that CAM allows?
Cristian
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I just figured that normalize-space is coming from XPath.
Still, we have one issue. The condition as it is in your example do not work. We'll try to figure it out.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes - we know this is wrong - but do you need the option to handle it anyway?
We are looking at some simple options to essentially do a normalize-space() on the content in CAMV before running the validation. Your backend will need to ensure it does that same clean-up during any data loading.
Thanks, David
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We have some rules that use restrictValues. The values from XML files sometimes have whitespaces before and after the actual values. The actual values match with the value list provided to restrictValues but because of the whitespaces the rules are failing.
Is there a way to ignore the whitespaces?
Thank you.
Cristian
Cristian, I'm having a little difficult visualizing this - could you post just the sample restrictValues() rule to help? You can post it here - just hit TAB key at start of the line before inserting - that way it retains the code as is.
Thanks, David
David,
Here is the error message taken from the console of CAMEd 3.2:
234503 [main] ERROR uk.org.jcam.camed.ui.wizards.camv.JCamWizard - Error: /itl:NISTBiometricInformationExchangePackage[1]/itl:PackageLatentImageRecord[1]/itl:FingerprintImage[1]/biom:FingerprintImageImpressionCaptureCategoryCode[1]: biom:FingerprintImageImpressionCaptureCategoryCode | Node does not contain an allowed value. =>Node: FingerprintImageImpressionCaptureCategoryCode
Here is the constraint definition taken from the .cam file:
<as:constraint action="restrictValues(//itl:FingerprintImage/biom:FingerprintImageImpressionCaptureCategoryCode,'0' |'1' |'2' |'3' |'4' |'5' |'6' |'7' |'8' |'10' |'11' |'12' |'13' |'14' |'15' |'20' |'21' |'22' |'23' |'24' |'25' |'26' |'27' |'28' |'29' |'30' |'31' |'32' |'33' |'34' |'35' |'36' |'37' |'38' |'39')">
Here is the format of the data taken from the input .xml file:
As you can see, between the tags there are some whitespaces (spaces, LineFeeds etc.).
If we manually remove the whitespaces (like this <biom:FingerprintImageImpressionCaptureCategoryCode>6</biom:FingerprintImageImpressionCaptureCategoryCode>) then the validation is ok.
Cristian
Cristian, strictly speaking according to the XML specification - those spaces are incorrect and it is an error to do that. Notice - persisting that data into a DB would cause similar issues (maybe worse!). BTAIM - here is the work-around using a conditional.
What this does is check condition="normalize-space( ./This) = ." so that the restrictValues is skipped when that's not true - but then - does an additional check that the length is 1 character.
David
Here
Didn't know about the normalize-space test. I just checked the OASIS CAM specification v1.1 but it does not appear there.
Where can we found the documentation for all the functions and conditions that CAM allows?
Cristian
I just figured that normalize-space is coming from XPath.
Still, we have one issue. The condition as it is in your example do not work. We'll try to figure it out.
Cristian, supplemental response.
Is the sample the typical content your exchanges are using?
Yes - we know this is wrong - but do you need the option to handle it anyway?
We are looking at some simple options to essentially do a normalize-space() on the content in CAMV before running the validation. Your backend will need to ensure it does that same clean-up during any data loading.
Thanks, David