cancel
Showing results for 
Search instead for 
Did you mean: 

Create Data Type from XSD

Former Member
0 Kudos

Hey guys

i need to create Data Type from and XSD,in the beginning i had an XML document which i converted to XSD using Altova ,then i imported this XSD in IR under External definition,now how should i go ahead with creating Data Type?

my sample XSD is something like this

<?xml version="1.0" encoding="UTF-8"?>

<!W3C Schema generated by XMLSpy v2007 sp2 (http://www.altova.com)>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="WorkOrderNumber">

<xs:simpleType>

<xs:restriction base="xs:short">

<xs:enumeration value="10942"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="VendorNumber">

<xs:simpleType>

<xs:restriction base="xs:int">

<xs:enumeration value="109845"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

Its not the complete XSD,just the first few lines.

thanx

Ahmad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Ahmad,

First of all if you have an XSD then you dont need to have an Datatype. You import it and use it directly.

If that doesnot fit your requirement then you have to create manually the datatype. So dont confuse yourself.

---Satish

Former Member
0 Kudos

Thanx Satish

yeah it looks like creating a DT manually will be the best option.

thanx for ur advice

Ahmad

Former Member
0 Kudos

Ahmed,

I do have same problem now...

i have provided by a sample structure which is in xml format..

when i am trying to import xsd in ED...then i am getting error...

so now they wanted me to create dattype manually..

ahmed could you plz help me.....what steps u have considered while preparing manual datatype.

Regards,

Reehan.

Former Member
0 Kudos

Hey

just have a look at the XML structure u have and create data types based upon that.

suppose ur XML is something like this

<?xml version="1.0" encoding="UTF-8" ?>

<InvoiceProperties>

<InvoiceNumber>0094887767</InvoiceNumber>

<InvoiceDate>20070418</InvoiceDate>

<VendorNumber>VENDOR #</VendorNumber>

<InvoiceType>L</InvoiceType>

<Emergency />

<PrimaryCurrency>

<CurrencyCode>USD</CurrencyCode>

</PrimaryCurrency>

</InvoiceProperties>

Then ur Data type will be

InvoiceProperies

->InvoiceNumber

->InvoiceDate

->VendorNumber

->InvoiceType

->Emergency

->PrimaryCurrency

--->CurrencyCode

Note:-> and --->means substructures,therefore

InvoiceProperties

->InvoiceNumber

means u will create a main type with the name InvoiceProperties then right click and select "Insert subelements".

if u have any questions mail me at ansari.xi@gmail.com

thanx

Ahmad Ansari

Message was edited by:

Ahmad

Answers (4)

Answers (4)

Former Member
0 Kudos

Hey guys

my XSD has quite a few messages under message type in External Definition,and they all the simple types,actually i want all of these messages in my Data Types,but when i use this ED in Message Interface,it asks me to select only 1 message.

how will i select all the messages

prabhu_s2
Active Contributor
0 Kudos

in message interface u can select only one message type. if u want to have all message then u need to have those wrapped into one xsd and reimport them

Former Member
0 Kudos

Hey Prabhu

how will i wrap them under one XSD and reimport them?

thanx

Ahmad

prabhu_s2
Active Contributor
0 Kudos

use an xsd editor. wrap means as nested/deep structures and as earlier mentioned u can import them asd use it in the message type

Former Member
0 Kudos

Hey Prabhu

i m using AltovaXML spy,do u mind tellin me how wil i wrap them using Altova or if u know any other XSD editor which can do the same

thanx

ahmad

prabhu_s2
Active Contributor
0 Kudos

hi ahmad

sorry if my context was misunderstood. wrap in the sense u need to have it as nested/deep strucutre....this got to be done manually. say u have one strucutre ST1 and another ST2. u need to combine these two and hence we have onemore ST3 which will have the ST1 and ST2 as its subnodes.

Former Member
0 Kudos

Hey Prabhu

my XSD looks like this

<?xml version="1.0" encoding="UTF-8"?>

<!W3C Schema generated by XMLSpy v2007 sp2 (http://www.altova.com)>

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">

<xs:element name="WorkOrderNumber">

<xs:simpleType>

<xs:restriction base="xs:short">

<xs:enumeration value="10942"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="VendorNumber">

<xs:simpleType>

<xs:restriction base="xs:int">

<xs:enumeration value="109845"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="UnitPrice">

<xs:complexType>

<xs:sequence>

<xs:element ref="MonetaryAmount"/>

<xs:element ref="UnitOfMeasureCode"/>

<xs:element ref="CurrencyCode"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="UnitOfMeasureCode">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="EA"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="TotalLineItems">

<xs:simpleType>

<xs:restriction base="xs:byte">

<xs:enumeration value="6"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="TaxTypeCode">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="GoodsAndServicesTax"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="TaxReference">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="GST"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="TaxAmount">

<xs:complexType>

<xs:sequence>

<xs:element ref="MonetaryAmount"/>

<xs:element ref="CurrencyCode"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Tax">

<xs:complexType>

<xs:sequence>

<xs:element ref="TaxTypeCode"/>

<xs:element ref="TaxAmount"/>

<xs:element ref="TaxReference"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Requisition">

<xs:complexType>

<xs:sequence>

<xs:element ref="Number"/>

<xs:element ref="LineItemNumber"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Quantity">

<xs:simpleType>

<xs:restriction base="xs:decimal">

<xs:enumeration value="1.0"/>

<xs:enumeration value="2.0"/>

<xs:enumeration value="6.0"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="PrimaryCurrency">

<xs:complexType>

<xs:sequence>

<xs:element ref="CurrencyCode"/>

<xs:element ref="ExchangeRate"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="Pricing">

<xs:complexType>

<xs:sequence>

<xs:element ref="UnitPrice"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="PaymentTerms">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="NT30"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="Number">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="Q173849"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="MonetaryAmount">

<xs:simpleType>

<xs:restriction base="xs:decimal">

<xs:enumeration value="1.98"/>

<xs:enumeration value="12.48"/>

<xs:enumeration value="12.63"/>

<xs:enumeration value="16.75"/>

<xs:enumeration value="24.96"/>

<xs:enumeration value="240.0"/>

<xs:enumeration value="33.84"/>

<xs:enumeration value="43.83"/>

<xs:enumeration value="5.64"/>

<xs:enumeration value="74.81"/>

<xs:enumeration value="87.66"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="LineItemTotal">

<xs:complexType>

<xs:sequence>

<xs:element ref="MonetaryAmount"/>

<xs:element ref="CurrencyCode"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="LineItemNumber">

<xs:simpleType>

<xs:restriction base="xs:byte">

<xs:enumeration value="10"/>

<xs:enumeration value="20"/>

<xs:enumeration value="30"/>

<xs:enumeration value="40"/>

<xs:enumeration value="50"/>

<xs:enumeration value="60"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="LineItemMaterialNumber">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="108739"/>

<xs:enumeration value="192740-A"/>

<xs:enumeration value="380495"/>

<xs:enumeration value="43998"/>

<xs:enumeration value="54727S"/>

<xs:enumeration value="5746"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="LineItemInformation">

<xs:complexType>

<xs:sequence>

<xs:element ref="LineItemMaterialNumber"/>

<xs:element ref="LineItemDescription"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="LineItemDescription">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="ABSRBT PAD 17 IN X 19 IN X 3/8 IN UNIV P"/>

<xs:enumeration value="BSHG HEX 1 IN X 1/2 IN THD FS A105N"/>

<xs:enumeration value="GGE 4 IN 1M / 7000 DL SCALE 1/2 IN LM WI"/>

<xs:enumeration value="PEN REC RD MED GRAPHIC 39-202"/>

<xs:enumeration value="PL ORF 3 IN .5 IN ORF SER 500 316 SS"/>

<xs:enumeration value="WPR F-200 FLC NOV LABEL 20"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="Invoices">

<xs:complexType>

<xs:sequence>

<xs:element ref="Invoice"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="InvoiceTypeCode">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="ProductOrService"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="InvoiceTotal">

<xs:complexType>

<xs:sequence>

<xs:element ref="MonetaryAmount"/>

<xs:element ref="CurrencyCode"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="InvoiceSummary">

<xs:complexType>

<xs:sequence>

<xs:element ref="TotalLineItems"/>

<xs:element ref="InvoiceTotal"/>

<xs:element ref="Tax"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="InvoiceQuantity">

<xs:complexType>

<xs:sequence>

<xs:element ref="Quantity"/>

<xs:element ref="UnitOfMeasureCode"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="InvoiceProperties">

<xs:complexType>

<xs:sequence>

<xs:element ref="InvoiceNumber"/>

<xs:element ref="InvoiceDate"/>

<xs:element ref="VendorNumber"/>

<xs:element ref="InvoiceTypeCode"/>

<xs:element ref="PrimaryCurrency"/>

<xs:element ref="PaymentTerms"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="InvoiceNumber">

<xs:simpleType>

<xs:restriction base="xs:int">

<xs:enumeration value="98815236"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="InvoiceLineItem">

<xs:complexType>

<xs:sequence>

<xs:element ref="WorkOrderNumber"/>

<xs:element ref="LineItemNumber"/>

<xs:element ref="InvoiceQuantity"/>

<xs:element ref="LineItemInformation"/>

<xs:element ref="Pricing"/>

<xs:element ref="LineItemTotal"/>

<xs:element ref="Requisition"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="InvoiceDetails">

<xs:complexType>

<xs:sequence>

<xs:element ref="InvoiceLineItem" maxOccurs="unbounded"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="InvoiceDate">

<xs:simpleType>

<xs:restriction base="xs:date">

<xs:enumeration value="2007-01-25"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

<xs:element name="Invoice">

<xs:complexType>

<xs:sequence>

<xs:element ref="InvoiceProperties"/>

<xs:element ref="InvoiceDetails"/>

<xs:element ref="InvoiceSummary"/>

</xs:sequence>

</xs:complexType>

</xs:element>

<xs:element name="ExchangeRate">

<xs:complexType/>

</xs:element>

<xs:element name="CurrencyCode">

<xs:simpleType>

<xs:restriction base="xs:string">

<xs:enumeration value="CAD"/>

</xs:restriction>

</xs:simpleType>

</xs:element>

</xs:schema>

can you please tell me how to nest the structures,i m fairly new to XSD and stuffs

thanx

ahmad

prabhu_s2
Active Contributor
0 Kudos

a broader view:

You could create Message Type (MT) in 3 ways :

1. Manual: Create Data Type (DT) & Create MT refering to it.

2. Import XSD as DT: Create a new DT by giving a name. The structure can be imported from a XSD. Tools-> Import XSD. (Note: the name of DT here should match the 'complex type' name in XSD). Then create a MT refering to this DT.

3. Import XSD as External Definition: An XSD can be imported into External definitions, and this creates the MT directly, and no DT required. They appear only under 'External Definitions'. Note: This XSD should contain a 'complex type' definition, which stands for DT. And also a root element declaration refering to this type, which stands for MT. In this case, we can have one XSD containing multiple DTs and MTs within it. All these MTs can be seen under the 'Messages' tab within an External Definition.

Former Member
0 Kudos

Thanx Guys

appreciate ur help.

Ahmad

Former Member
0 Kudos

No need to create Data type and messge type for XSD. you can directly start from message interface.

Former Member
0 Kudos

HI,

XSD is equal to data type ,

you have to create the message type with imorted XSD under external definition

Regards

Chilla