kibook / s1kd-tools

A set of small, free and open source software tools for manipulating S1000D data.
https://khzae.net/1/s1000d/s1kd-tools
GNU General Public License v3.0
38 stars 13 forks source link

s1kd-brexcheck - Not working correctly #3

Closed MihailCosmin closed 4 years ago

MihailCosmin commented 4 years ago

Hi, I was just trying to check some simple brex rules for some DMs, but I am not sure if it is wokring at all.

The cmd I used:

s1kd-brexcheck -v -b DMC-S1000D-E-04-10-0301-00A-022A-D_009-00_EN-US.XML DMC-***.XML

The result is always: s1kd-brexcheck: SUCCESS: DMC-***.XML validated successfully against BREX DMC-S1000D-E-04-10-0301-00A-022A-D_009-00_EN-US.XML.

Even though I obviously make some mistakes in the DM XML just to get an error message from the BREX checker.

For example, the standard BREX allows for @securityClassification the values from 01 to 09. I added in my DM the value "11". And the check was succesful, instead of giving me an error.

Am I doing something wrong? or Does the BREX check only check some brex rules and not all of them ?

kibook commented 4 years ago

Hello @MihailCosmin!

By default, the s1kd-brexcheck tool only uses the XPath expression in the <objectUse> part of a BREX rule to validate objects. To also validate the values of nodes matched by the XPath expressions against the <objectValue> elements in a BREX rule, you have to specify the -c/--values option.

$ s1kd-brexcheck -cv -b DMC-S1000D-E-04-10-0301-00A-022A-D_009-00_EN-US.XML DMC-***.XML
MihailCosmin commented 4 years ago

Wow, thanks, that worked!

Also another check I was doing and didn't worked before was @modelIdentCode. Which I was setting to only one allowed value in the BREX.

But now works, it is picked up as wrong if it doesn't match the allowed value.