Closed drj826 closed 8 years ago
I inspected the code and didn't find any logic to validate that an element is allowed within the division in which it appears. That's odd, I thought I checked for this error condition. I guess not. It's easy enough to add.
The SML::Ontology class has a public method 'allows_property_name_in_division_name' which returns 1 if the ontology allows the specified property in the specified division. The parser should invoke this method to perform the required validation.
The question is, "When should this validation take place?" I think it should take place at the earliest possible time during parsing, and that is during '_parse_lines' when the parser encounters the first line of the element and calls the '_process_start_element' method. At that point in time the parser has all the information it needs to validate the element is allowed to appear within the division currently being parsed.
I started to work on #64 -- I commented out the document property declaration that said a document can have a 'version' property and then re-published the library expecting to see warnings or errors about an unknown property. To my surprise, I didn't get any warnings or errors. It appears something may be wrong with the parser's validation logic.