-
-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
xsdata creates two classes for the same type #1106
Comments
It's quite common vendors to give the same name to complex types and elements, xsdata has to add these suffixes to avoid duplicate class names. <xs:complexType name="portAccessType">
<xs:sequence>
<xs:element ref="spirit:portAccessType" minOccurs="0">
<xs:annotation>
<xs:documentation>Indicates how a netlister accesses a port. 'ref' means accessed by reference (default) and 'ptr' means accessed through a pointer.</xs:documentation>
</xs:annotation>
</xs:element>
<xs:element ref="spirit:portAccessHandle" minOccurs="0"/>
</xs:sequence>
</xs:complexType> |
That is fair, but xml serialization is failing on valid xml on these duplicates. Somehow they are mixed up. |
Here are some problematic xml files that fail to deserialize: For
Similar issue with
Somehow portAccessType is not correctly bound to the correct class. |
Confirmed something wrong is going on here, I am on it |
Is there a place where I can download a bunch of these samples, something like a repo somewhere? |
There are many examples here:
Matching these schemas:
Out of 618 xml files, only 19 are failing. I think both are related to
|
Thanks for reporting @amal-khailtash very interesting suite, I took the liberty to include it in the samples repo https://github.com/tefra/xsdata-samples/tree/main/ipxact The fix is on main! |
That is great. All the XMLs' in those files pass now. I do have one more sample file: from a document that is NOT passing and failing with this:
The problem is with this under <ipxact:busInterface>
<ipxact:name>MirroredTarget</ipxact:name>
<ipxact:busType vendor="accellera.org" library="Sample" name="SampleBusDefinition" version="1.0"/>
<!-- LINK: mirroredTarget: see 6.7.7, Mirrored target interface -->
<ipxact:mirroredTarget>
<ipxact:baseAddresses>
<ipxact:remapAddress>'h40000000</ipxact:remapAddress>
<ipxact:range>'h1000</ipxact:range>
</ipxact:baseAddresses>
</ipxact:mirroredTarget>
</ipxact:busInterface> |
Thanks I will check the XML file. You might be right. |
Confirmed. Thank you! |
I am not sure what is going on, but there seems to be two dataclasses defined from the same type. The same problem shows up in different schemas from here: http://www.accellera.org/XMLSchema
Specifically the problematic type is portAccessType defined in:
http://www.accellera.org/XMLSchema/SPIRIT/1.5/port.xsd
http://www.accellera.org/XMLSchema/SPIRIT/1685-2009/port.xsd
http://www.accellera.org/XMLSchema/IPXACT/1685-2014/port.xsd
http://www.accellera.org/XMLSchema/IPXACT/1685-2022/port.xsd
They all show the same issue.
I see two python files (
port_access_type.py
andport_access_type_1.py
) generated with classesPortAccessType
andPortAccessType1
respectively. Both of these have:Here are the two files:
port_access_type.py
port_access_type1.py
I see a number of duplicate files with
*1.py
,*2.py
with the same class Meta names!http://www.accellera.org/XMLSchema/SPIRIT/1685-2009-VE-1.0/
http://www.accellera.org/XMLSchema
Here are the commands I use to generate the binding classes.
I am not sure if the problem is with the XSDs or a bug in xsdata.
The text was updated successfully, but these errors were encountered: