on 06-22-2007 12:14 AM
My source and target "Structures" are similar, following is the xsd...
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns="urn:testmap.com" targetNamespace="urn:testmap.com">
<xsd:element name="shipment" type="shipment" />
<xsd:complexType name="shipment">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
c03352d0204a11dc80c80002556a8e03
</xsd:appinfo>
</xsd:annotation>
<xsd:sequence>
<xsd:element name="Header">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437870204911dc84170019b9313caf
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="InvoiceNo" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437871204911dcc8bc0019b9313caf
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="OrderNo" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437872204911dca6c60019b9313caf
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Date" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437873204911dc82e80019b9313caf
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="Sequence" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437874204911dccc790019b9313caf
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Currency" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437875204911dc97050019b9313caf
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="OrderNo" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437876204911dc8b720019b9313caf
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="SeqNo" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437877204911dcb9590019b9313caf
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="LineItem" minOccurs="0" maxOccurs="unbounded">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437878204911dcbbf60019b9313caf
</xsd:appinfo>
</xsd:annotation>
<xsd:complexType>
<xsd:sequence>
<xsd:element name="SeqNo" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a0437879204911dca83e0019b9313caf
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="ItemNo" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a043787a204911dca6d40019b9313caf
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
<xsd:element name="Cost" type="xsd:string">
<xsd:annotation>
<xsd:appinfo source="http://sap.com/xi/TextID">
a043787b204911dcb5dc0019b9313caf
</xsd:appinfo>
</xsd:annotation>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:element>
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
<b>I am receiving following xml from source service :-</b>
<?xml version="1.0" encoding="UTF-8"?>
<ns0:shipment xmlns:ns0="urn:testmap.com">
<Header>
<InvoiceNo>100</InvoiceNo>
<OrderNo>ord1</OrderNo>
<Date>2005-23-02</Date>
</Header>
<Sequence>
<Currency>USD</Currency>
<OrderNo>ord1</OrderNo>
<SeqNo>1</SeqNo>
</Sequence>
<LineItem>
<SeqNo>1</SeqNo>
<ItemNo>1</ItemNo>
<Cost>23</Cost>
</LineItem>
<LineItem>
<SeqNo>1</SeqNo>
<ItemNo>2</ItemNo>
<Cost>54</Cost>
</LineItem>
<Sequence>
<Currency>USD</Currency>
<OrderNo>ord1</OrderNo>
<SeqNo>2</SeqNo>
</Sequence>
<LineItem>
<SeqNo>2</SeqNo>
<ItemNo>1</ItemNo>
<Cost>900</Cost>
</LineItem>
<LineItem>
<SeqNo>2</SeqNo>
<ItemNo>2</ItemNo>
<Cost>478</Cost>
</LineItem>
</ns0:shipment>
And I "<b>need</b>" to convert it to:-
<?xml version="1.0" encoding="UTF-8"?>
<ns0:shipment xmlns:ns0="urn:testmap.com">
<Header>
<InvoiceNo>100</InvoiceNo>
<OrderNo>ord1</OrderNo>
<Date>20052302</Date>
</Header>
<Sequence>
<Currency>USD</Currency>
<OrderNo>ord1</OrderNo>
<SeqNo>1</SeqNo>
</Sequence>
<LineItem>
<SeqNo>1</SeqNo>
<ItemNo>1</ItemNo>
<Cost>23</Cost>
</LineItem>
<LineItem>
<SeqNo>1</SeqNo>
<ItemNo>2</ItemNo>
<Cost>54</Cost>
</LineItem>
<Sequence>
<Currency>USD</Currency>
<OrderNo>ord1</OrderNo>
<SeqNo>2</SeqNo>
</Sequence>
<LineItem>
<SeqNo>2</SeqNo>
<ItemNo>1</ItemNo>
<Cost>900</Cost>
</LineItem>
<LineItem>
<SeqNo>2</SeqNo>
<ItemNo>2</ItemNo>
<Cost>478</Cost>
</LineItem>
</ns0:shipment>
I added date transformation function in GUI map(date function works fine!!)
But XI's graphical mapping has <b>changed</b> structure to:-
<?xml version="1.0" encoding="UTF-8"?>
<ns0:shipment xmlns:ns0="urn:testmap.com">
<Header>
<InvoiceNo>100</InvoiceNo>
<OrderNo>ord1</OrderNo>
<Date>20052302</Date>
</Header>
<Sequence>
<Currency>USD</Currency>
<OrderNo>ord1</OrderNo>
<SeqNo>1</SeqNo>
</Sequence>
<Sequence>
<Currency>USD</Currency>
<OrderNo>ord1</OrderNo>
<SeqNo>2</SeqNo>
</Sequence>
<LineItem>
<SeqNo>1</SeqNo>
<ItemNo>1</ItemNo>
<Cost>23</Cost>
</LineItem><LineItem>
<SeqNo>1</SeqNo>
<ItemNo>2</ItemNo>
<Cost>54</Cost>
</LineItem>
<LineItem>
<SeqNo>2</SeqNo>
<ItemNo>1</ItemNo>
<Cost>900</Cost>
</LineItem>
<LineItem>
<SeqNo>2</SeqNo>
<ItemNo>2</ItemNo>
<Cost>478</Cost>
</LineItem>
</ns0:shipment>
Pls observe that XI has converted it in such a way that <b>all Sequence elements appear first</b> and <b>then all LineItem elements</b>, whereas that is not our "requirement".
I guess this is due to XI's internal queue mechanism and I guess XSLT or java mapping would be required to get the structure that I need.
Does anyone has any available XSLT/Java coding for this?
Appreciate your help and points would be rewarded to all helpful answers
Hello,
I have imported your XSD into the Mapping editor and executed the mapping. I can suggest you one thing, but I don't know whether its feasible for you or not. I'll tell my suggestion , see you have created Data type as Header, Sequence and Line Item in the same level. Is it possible for you to create Header, Sequence and Line Item as the Sub-element of Sequence. It will solve your problem.
Header
-
Sequence
-
Line Item.
Provide your feedback on this.
Best regards,
raj.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
87 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.