Rank: Newbie
Joined: 3/6/2020 Posts: 3
|
I tried to export a XSD to Postgres. But the generated database is completely useless.
First the XML data type xsd:string gets converted to bit(1).
Second my schema has a structure. Delivery has two child nodes: Header and Item.
Code: <xsd:element name="Delivery" type="tns:DeliveryType"/>
<xsd:complexType name="DeliveryType"> <xsd:sequence> <xsd:element name="Header" type="tns:DeliveryHeaderType"/> <xsd:element name="Item" type="tns:DeliveryItemType" maxOccurs="unbounded"/> </xsd:sequence> </xsd:complexType>
<xsd:complexType name="DeliveryHeaderType"> <xsd:sequence> <xsd:element name="VendorID" type="xsd:string"/> <xsd:element name="DeliveryNbr" type="xsd:string"/> <xsd:element name="DelvDate" type="xsd:date"/> </xsd:sequence> </xsd:complexType>
<xsd:complexType name="DeliveryItemType"> <xsd:sequence> <xsd:element name="ItemDescr" type="tns:DeviceDescriptionType" minOccurs="0" maxOccurs="unbounded"/> <xsd:element name="DeliveryItemNbr" type="xsd:string"/> <xsd:element name="Quantity" type="xsd:float"/> <xsd:element name="Unit" type="xsd:string"/> <xsd:element name="SecunetMaterialNbr" type="xsd:string" minOccurs="0"/> <xsd:element name="VendorMaterialNbr" type="xsd:string"/> <xsd:element name="SecPONbr" type="xsd:string"/> <xsd:element name="SecPOItm" type="xsd:string" minOccurs="0"/> </xsd:sequence> </xsd:complexType>
XMLSpy generates for the above XML two tables:
Code: CREATE TABLE public."Header" ( "VendorID" bit(1) NOT NULL, "DeliveryNbr" bit(1) NOT NULL, "DelvDate" character varying(255) COLLATE pg_catalog."default" NOT NULL )
CREATE TABLE public."Item" ( "DeliveryItemNbr" bit(1) NOT NULL, "Quantity" real NOT NULL, "Unit" bit(1) NOT NULL, "SecunetMaterialNbr" bit(1), "VendorMaterialNbr" bit(1) NOT NULL, "SecPONbr" bit(1) NOT NULL, "SecPOItm" bit(1) )
But I can not see any relation. How to know that a deliver item belongs to a delivery?
I have no idea how this could ever work.
How to fix this?File Attachment(s): 2020-08-04 13_28_48-Altova XMLSpy - xsd-string to (202kb) downloaded 0 time(s).
|
Rank: Advanced Member
Joined: 2/27/2009 Posts: 565
|
Regarding the conversion of xsd:string to bit, that appears to be a genuine problem. I recommend you report this directly to Altova Support.
Regarding the relationship, note that XMLSpy will create relationships between the tables when the schema has relationships defined in the form of identity constraints (see “Creating DB tables with relationships”). So, first add these to your schema, then try converting again.
|