Skip to content

'XsdComplexType' object has no attribute 'min_length' #31

@ikomef

Description

@ikomef

Hello.
I was trying to import the French db on phyto products (https://www.data.gouv.fr/fr/datasets/donnees-ouvertes-du-catalogue-e-phy-des-produits-phytopharmaceutiques-matieres-fertilisantes-et-supports-de-culture-adjuvants-produits-mixtes-et-melanges/)
But got this error. They use quite complex schemas with type inheritance and extensions, but seems the app crashed on the very beginning of parsing.
Here is the crash

File "/tmp/venv/lib/python3.13/site-packages/xml2db/model.py", line 136, in init
self._build_model()
~~~~~~~~~~~~~~~~~^^
File "/tmp/venv/lib/python3.13/site-packages/xml2db/model.py", line 228, in _build_model
root_table = self._parse_tree(
self.xml_schema[0] if len(self.xml_schema) == 1 else self.xml_schema
)
File "/tmp/venv/lib/python3.13/site-packages/xml2db/model.py", line 517, in _parse_tree
child_table = self._parse_tree(child, nodes_path)
File "/tmp/venv/lib/python3.13/site-packages/xml2db/model.py", line 517, in _parse_tree
child_table = self._parse_tree(child, nodes_path)
File "/tmp/venv/lib/python3.13/site-packages/xml2db/model.py", line 517, in _parse_tree
child_table = self._parse_tree(child, nodes_path)
[Previous line repeated 3 more times]
File "/tmp/venv/lib/python3.13/site-packages/xml2db/model.py", line 553, in _parse_tree
) = recurse_parse_simple_type([parent_node.type.base_type])
~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/tmp/venv/lib/python3.13/site-packages/xml2db/model.py", line 406, in recurse_parse_simple_type
elem_type.min_length,
^^^^^^^^^^^^^^^^^^^^
AttributeError: 'XsdComplexType' object has no attribute 'min_length'

And here is the first xsd

> <?xml version="1.0" encoding="UTF-8"?>
> <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xml:lang="fr">
> 	<!-- 
> 		Schéma relatif aux données de décision d'AMM pour les intrants.
> 		fichier "reponse"
> 	 -->
> 	<xs:include schemaLocation="intrant.xsd" />
> 	<!-- Elément root :
> 		en cas de flux "intrant" :
> 		  - intrants : liste des produits soumis à décision.
> 		  - contexte : méta données sur le fichier
> 	 -->
> 	<xs:element name="reponse">
> 		<xs:complexType>
> 			<xs:sequence>
> 				<xs:element name="intrants" type="intrants" minOccurs="0" />
> 			</xs:sequence>
> 		</xs:complexType>
> 	</xs:element>
> </xs:schema>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions