diff --git a/pyxform/entities/entities_parsing.py b/pyxform/entities/entities_parsing.py index 7f6b9460..2ca256ee 100644 --- a/pyxform/entities/entities_parsing.py +++ b/pyxform/entities/entities_parsing.py @@ -28,6 +28,11 @@ def get_entity_declaration(workbook_dict: Dict, warnings: List) -> Dict: f"Invalid dataset name: '{dataset}' starts with reserved prefix {constants.ENTITIES_RESERVED_PREFIX}." ) + if "." in dataset: + raise PyXFormError( + f"Invalid dataset name: '{dataset}'. Dataset names may not include periods." + ) + if not is_valid_xml_tag(dataset): if isinstance(dataset, bytes): dataset = dataset.encode("utf-8") diff --git a/tests/test_entities.py b/tests/test_entities.py index 2b99db69..3fc5237f 100644 --- a/tests/test_entities.py +++ b/tests/test_entities.py @@ -85,6 +85,23 @@ def test_dataset_with_invalid_xml_name__errors(self): ], ) + def test_dataset_with_period_in_name__errors(self): + self.assertPyxformXform( + name="data", + md=""" + | survey | | | | + | | type | name | label | + | | text | a | A | + | entities | | | | + | | dataset | label | | + | | s.w.eet | a | | + """, + errored=True, + error__contains=[ + "Invalid dataset name: 's.w.eet'. Dataset names may not include periods." + ], + ) + def test_worksheet_name_close_to_entities__produces_warning(self): self.assertPyxformXform( name="data",