IMPORTANT:
this is not a Support Forum! Experienced users might answer from time to time questions posted here. If you need a professional and reliable answer, or if you want to report a bug, please contact Altova Support instead.

XSD export to Postgresql Options · View
szi
Posted: Tuesday, August 4, 2020 11:59:55 AM
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).


K101
Posted: Thursday, August 6, 2020 7:26:04 AM
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.
Users browsing this topic
guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Use of the Altova User Forum(s) is governed by the Altova Terms of Use.