Hi Guys,
I am facing problem on the xml output format. I am reading source data from a flat file and generating output xml file.
The source have 2 records, when I creat the xml file, the root element tag in tne xml file have been creating 2 times (2 source records). But my expected output xml should be once root element tag followed by the 'n' number of child elements( 2 child records).
example:
Here is the expected xml format
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSPY v2004 rel. 4 U (http://www.xmlspy.com)-->
<TIMSStockStatus xmlns="http://www.michelin.com/TIMS/stockstatus" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.michelin.com/TIMS/stockstatus
C:\Rajesh\Work\TIMS\NEWFOL~1\TIMS_SSF.xsd" customer_name="String" file_date="2001-12-17T09:30:47-05:00">
<StockStatus sale_date="1967-08-13">
<LineItem>
<SupplierBrand>String</SupplierBrand>
<Store>String</Store>
<CPN>String</CPN>
<RetailUnits>0</RetailUnits>
<WholesaleUnits>0</WholesaleUnits>
<OnHandUnits>0</OnHandUnits>
<ServiceLevelKey>String</ServiceLevelKey>
<SupplierDesc>String</SupplierDesc>
<StyleDesc>String</StyleDesc>
<MSPN>String</MSPN>
<SizeDesc>String</SizeDesc>
<MarketGroup>String</MarketGroup>
<OnOrderUnits>0</OnOrderUnits>
<CommitUnits>0</CommitUnits>
<BackOrderUnits>0</BackOrderUnits>
<OrderUnits>0</OrderUnits>
<ReturnUnits>0</ReturnUnits>
<OrderActiveSKU>String</OrderActiveSKU>
<PalletQty>0</PalletQty>
<TireWeight>3.14159265358979</TireWeight>
</LineItem>
<LineItem>
<SupplierBrand>String</SupplierBrand>
<Store>String</Store>
<CPN>String</CPN>
<RetailUnits>0</RetailUnits>
<WholesaleUnits>0</WholesaleUnits>
<OnHandUnits>0</OnHandUnits>
<ServiceLevelKey>String</ServiceLevelKey>
<SupplierDesc>String</SupplierDesc>
<StyleDesc>String</StyleDesc>
<MSPN>String</MSPN>
<SizeDesc>String</SizeDesc>
<MarketGroup>String</MarketGroup>
<OnOrderUnits>0</OnOrderUnits>
<CommitUnits>0</CommitUnits>
<BackOrderUnits>0</BackOrderUnits>
<OrderUnits>0</OrderUnits>
<ReturnUnits>0</ReturnUnits>
<OrderActiveSKU>String</OrderActiveSKU>
<PalletQty>0</PalletQty>
<TireWeight>3.14159265358979</TireWeight>
</LineItem>
</StockStatus>
<StockStatus sale_date="1967-08-13">
<LineItem>
<SupplierBrand>String</SupplierBrand>
<Store>String</Store>
<CPN>String</CPN>
<RetailUnits>0</RetailUnits>
<WholesaleUnits>0</WholesaleUnits>
<OnHandUnits>0</OnHandUnits>
<ServiceLevelKey>String</ServiceLevelKey>
<SupplierDesc>String</SupplierDesc>
<StyleDesc>String</StyleDesc>
<MSPN>String</MSPN>
<SizeDesc>String</SizeDesc>
<MarketGroup>String</MarketGroup>
<OnOrderUnits>0</OnOrderUnits>
<CommitUnits>0</CommitUnits>
<BackOrderUnits>0</BackOrderUnits>
<OrderUnits>0</OrderUnits>
<ReturnUnits>0</ReturnUnits>
<OrderActiveSKU>String</OrderActiveSKU>
<PalletQty>0</PalletQty>
<TireWeight>3.14159265358979</TireWeight>
</LineItem>
<LineItem>
<SupplierBrand>String</SupplierBrand>
<Store>String</Store>
<CPN>String</CPN>
<RetailUnits>0</RetailUnits>
<WholesaleUnits>0</WholesaleUnits>
<OnHandUnits>0</OnHandUnits>
<ServiceLevelKey>String</ServiceLevelKey>
<SupplierDesc>String</SupplierDesc>
<StyleDesc>String</StyleDesc>
<MSPN>String</MSPN>
<SizeDesc>String</SizeDesc>
<MarketGroup>String</MarketGroup>
<OnOrderUnits>0</OnOrderUnits>
<CommitUnits>0</CommitUnits>
<BackOrderUnits>0</BackOrderUnits>
<OrderUnits>0</OrderUnits>
<ReturnUnits>0</ReturnUnits>
<OrderActiveSKU>String</OrderActiveSKU>
<PalletQty>0</PalletQty>
<TireWeight>3.14159265358979</TireWeight>
</LineItem>
</StockStatus>
</TIMSStockStatus>
****************************************
Actual xml format
<defns:TIMSStockStatus xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:defns="http://www.michelin.com/TIMS/stockstatus" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" customer_name="ABCD" file_date="2007-08-29 19:10:04"><defns:StockStatus sale_date="1960-01-03 16:50:32">
<defns:LineItem>
<defns:SupplierBrand></defns:SupplierBrand>
<defns:Store></defns:Store>
<defns:CPN>
a
</defns:CPN>
<defns:RetailUnits>
2
</defns:RetailUnits>
<defns:WholesaleUnits>
2334
</defns:WholesaleUnits>
<defns:OnHandUnits>
32423
</defns:OnHandUnits>
<defns:ServiceLevelKey>
aaaaaaaaaaaaaaaaaaa
</defns:ServiceLevelKey>
<defns:SupplierDesc>
aa
</defns:SupplierDesc>
<defns:StyleDesc>
aaaaaaaaaaaa
</defns:StyleDesc>
<defns:MSPN>
aa
</defns:MSPN>
<defns:SizeDesc>
a
</defns:SizeDesc>
<defns:MarketGroup>
aa
</defns:MarketGroup>
<defns:OnOrderUnits>
4232
</defns:OnOrderUnits>
<defns:CommitUnits>
22323
</defns:CommitUnits>
<defns:BackOrderUnits>
2342
</defns:BackOrderUnits>
<defns:OrderUnits>
34232
</defns:OrderUnits>
<defns:ReturnUnits>
2532
</defns:ReturnUnits>
<defns:OrderActiveSKU></defns:OrderActiveSKU>
<defns:PalletQty>
3422
</defns:PalletQty>
<defns:TireWeight>
0
</defns:TireWeight>
</defns:LineItem>
</defns:StockStatus>
</defns:TIMSStockStatus>
<defns:TIMSStockStatus xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:defns="http://www.michelin.com/TIMS/stockstatus" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" customer_name="ABCD" file_date="2007-08-29 19:10:04"><defns:StockStatus sale_date="1960-01-03 16:50:33">
<defns:LineItem>
<defns:SupplierBrand>
bbbb
</defns:SupplierBrand>
<defns:Store>
bbbb
</defns:Store>
<defns:CPN>
b
</defns:CPN>
<defns:RetailUnits>
3
</defns:RetailUnits>
<defns:WholesaleUnits>
2335
</defns:WholesaleUnits>
<defns:OnHandUnits>
32424
</defns:OnHandUnits>
<defns:ServiceLevelKey>
bbbbb
</defns:ServiceLevelKey>
<defns:SupplierDesc>
bbbbb
</defns:SupplierDesc>
<defns:StyleDesc>
bbbbb
</defns:StyleDesc>
<defns:MSPN>
bbbbb
</defns:MSPN>
<defns:SizeDesc>
b
</defns:SizeDesc>
<defns:MarketGroup>
bbbbb
</defns:MarketGroup>
<defns:OnOrderUnits>
4233
</defns:OnOrderUnits>
<defns:CommitUnits>
22324
</defns:CommitUnits>
<defns:BackOrderUnits>
2343
</defns:BackOrderUnits>
<defns:OrderUnits>
34233
</defns:OrderUnits>
<defns:ReturnUnits>
2533
</defns:ReturnUnits>
<defns:OrderActiveSKU>
bbbb
</defns:OrderActiveSKU>
<defns:PalletQty>
3423
</defns:PalletQty>
<defns:TireWeight>
0
</defns:TireWeight>
</defns:LineItem>
</defns:StockStatus>
</defns:TIMSStockStatus>
The red color font is the Root element tag, which is repeated twice in the actual xml format but the expected xml format should be only one root element tag.
Please let me know your views asap.
xml output format error
Moderators: chulett, rschirm, roy
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
Data element description for your input is mostly not well described.
In the input column tab of your XML output stage you should give descriptions in the below format:
Ex:
Output:
In the input column tab of your XML output stage you should give descriptions in the below format:
Ex:
Where Value will be your repetition element.
Header --> /Message/Header/
Value --> /Message/Header/Value/text()
Output:
<Message>
<Header>
<Value>Val1</Value>
<Value>Val2</Value>
</Header>
</Message>
Also make sure in the Output -> Transformation Settings tab you have checked Output Mode as 'Aggregate all rows'.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Josh,
Thanks for your reply. Actually I have mentioned the data element description in the same type (Value --> /Message/Header/Value/text()) but I didn't mention the header because if I mention the header as a field in the input then I have to map the source data to the header field which is present in the input tab. There is no data to map it to the header.
Ex
"??????" which means what value should I populate to the header in the input tab of xml_output stage.
Thanks
Rajesh L
Thanks for your reply. Actually I have mentioned the data element description in the same type (Value --> /Message/Header/Value/text()) but I didn't mention the header because if I mention the header as a field in the input then I have to map the source data to the header field which is present in the input tab. There is no data to map it to the header.
Ex
Code: Select all
Source_flat file INPUT tab of xml_output
"AAA" Value_col (/Message/Header/Value/text())
?????? Header_col (/Message/Header/)
"??????" which means what value should I populate to the header in the input tab of xml_output stage.
Thanks
Rajesh L
JoshGeorge wrote:Data element description for your input is mostly not well described.
In the input column tab of your XML output stage you should give descriptions in the below format:
Ex:
Where Value will be your repetition element.
Header --> /Message/Header/
Value --> /Message/Header/Value/text()
Output:
<Message>
<Header>
<Value>Val1</Value>
<Value>Val2</Value>
</Header>
</Message>
Also make sure in the Output -> Transformation Settings tab you have checked Output Mode as 'Aggregate all rows'.
-
- Participant
- Posts: 612
- Joined: Thu May 03, 2007 4:59 am
- Location: Melbourne
Don't worry about that, pass any dummy value to header and see. That won't get printed.
Note: I have just given you an example so that you will get an idea where you have to correct it.
Note: I have just given you an example so that you will get an idea where you have to correct it.
Joshy George
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
<a href="http://www.linkedin.com/in/joshygeorge1" ><img src="http://www.linkedin.com/img/webpromo/bt ... _80x15.gif" width="80" height="15" border="0"></a>
Josh,
I tried to keep the root path in the input column, but it does n't work. But I rearrange the column field i.e. I have moved the root attribute field to the last field in the input columns, then the xml output able to generate only one root element tab with n number of records.
I have some other issue on this.
My Expected xml output file as follows
The actual xml file which I am getting as follows
If you see in the Expected xml code the red color highlighted attribute <defns:StockStatus sale_date. This attribute followed by the <defns:LineItem:> 2 times (Since 2 input records) and again 2nd <defns:StockStatus sale_date followed by 2 <defns:LineItem:>. This is the expected format.
<StockStatus sale_date="xxxx-xx-xx">
But in my actual xml output file, i am getting 1 <defns:StockStatus sale_date followed by 1 <defns:LineItem:> and 2nd <defns:StockStatus sale_date followed by 1 <defns:LineItem:>.
I know there is something need to work on the xpath expressing/arrangement, Please let me know the solution.
Thanks in advance,
Rajesh
I tried to keep the root path in the input column, but it does n't work. But I rearrange the column field i.e. I have moved the root attribute field to the last field in the input columns, then the xml output able to generate only one root element tab with n number of records.
I have some other issue on this.
My Expected xml output file as follows
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!--Sample XML file generated by XMLSPY v2004 rel. 4 U (http://www.xmlspy.com)-->
<TIMSStockStatus xmlns="http://www.michelin.com/TIMS/stockstatus" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.michelin.com/TIMS/stockstatus
C:\Rajesh\Work\TIMS\NEWFOL~1\TIMS_SSF.xsd" customer_name="String" file_date="2001-12-17T09:30:47-05:00">
[color=red]<StockStatus sale_date="1967-08-13">[/color]
<LineItem>
<SupplierBrand>String</SupplierBrand>
<Store>String</Store>
<CPN>String</CPN>
<RetailUnits>0</RetailUnits>
<WholesaleUnits>0</WholesaleUnits>
<OnHandUnits>0</OnHandUnits>
<ServiceLevelKey>String</ServiceLevelKey>
<SupplierDesc>String</SupplierDesc>
<StyleDesc>String</StyleDesc>
<MSPN>String</MSPN>
<SizeDesc>String</SizeDesc>
<MarketGroup>String</MarketGroup>
<OnOrderUnits>0</OnOrderUnits>
<CommitUnits>0</CommitUnits>
<BackOrderUnits>0</BackOrderUnits>
<OrderUnits>0</OrderUnits>
<ReturnUnits>0</ReturnUnits>
<OrderActiveSKU>String</OrderActiveSKU>
<PalletQty>0</PalletQty>
<TireWeight>3.14159265358979</TireWeight>
</LineItem>
<LineItem>
<SupplierBrand>String</SupplierBrand>
<Store>String</Store>
<CPN>String</CPN>
<RetailUnits>0</RetailUnits>
<WholesaleUnits>0</WholesaleUnits>
<OnHandUnits>0</OnHandUnits>
<ServiceLevelKey>String</ServiceLevelKey>
<SupplierDesc>String</SupplierDesc>
<StyleDesc>String</StyleDesc>
<MSPN>String</MSPN>
<SizeDesc>String</SizeDesc>
<MarketGroup>String</MarketGroup>
<OnOrderUnits>0</OnOrderUnits>
<CommitUnits>0</CommitUnits>
<BackOrderUnits>0</BackOrderUnits>
<OrderUnits>0</OrderUnits>
<ReturnUnits>0</ReturnUnits>
<OrderActiveSKU>String</OrderActiveSKU>
<PalletQty>0</PalletQty>
<TireWeight>3.14159265358979</TireWeight>
</LineItem>
</StockStatus>
[color=red]<StockStatus sale_date="1967-08-13">[/color]
<LineItem>
<SupplierBrand>String</SupplierBrand>
<Store>String</Store>
<CPN>String</CPN>
<RetailUnits>0</RetailUnits>
<WholesaleUnits>0</WholesaleUnits>
<OnHandUnits>0</OnHandUnits>
<ServiceLevelKey>String</ServiceLevelKey>
<SupplierDesc>String</SupplierDesc>
<StyleDesc>String</StyleDesc>
<MSPN>String</MSPN>
<SizeDesc>String</SizeDesc>
<MarketGroup>String</MarketGroup>
<OnOrderUnits>0</OnOrderUnits>
<CommitUnits>0</CommitUnits>
<BackOrderUnits>0</BackOrderUnits>
<OrderUnits>0</OrderUnits>
<ReturnUnits>0</ReturnUnits>
<OrderActiveSKU>String</OrderActiveSKU>
<PalletQty>0</PalletQty>
<TireWeight>3.14159265358979</TireWeight>
</LineItem>
<LineItem>
<SupplierBrand>String</SupplierBrand>
<Store>String</Store>
<CPN>String</CPN>
<RetailUnits>0</RetailUnits>
<WholesaleUnits>0</WholesaleUnits>
<OnHandUnits>0</OnHandUnits>
<ServiceLevelKey>String</ServiceLevelKey>
<SupplierDesc>String</SupplierDesc>
<StyleDesc>String</StyleDesc>
<MSPN>String</MSPN>
<SizeDesc>String</SizeDesc>
<MarketGroup>String</MarketGroup>
<OnOrderUnits>0</OnOrderUnits>
<CommitUnits>0</CommitUnits>
<BackOrderUnits>0</BackOrderUnits>
<OrderUnits>0</OrderUnits>
<ReturnUnits>0</ReturnUnits>
<OrderActiveSKU>String</OrderActiveSKU>
<PalletQty>0</PalletQty>
<TireWeight>3.14159265358979</TireWeight>
</LineItem>
</StockStatus>
</TIMSStockStatus>
Code: Select all
<!--Generated by Ascential Software Corporation, DataStage - XMLOutput stage - Fri Aug 31 11:04:11 2007 -->
<defns:TIMSStockStatus xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:defns="http://www.michelin.com/TIMS/stockstatus" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xsi:schemaLocation="http://www.michelin.com/TIMS/stockstatus C:\Rajesh\Work\TIMS\NEWFOL~1\TIMS_SSF.xsd" customer_name="ABC" file_date="2001-12-17T09:30:47-05:00">
[color=red]<defns:StockStatus sale_date="1960-01-03">[/color]
<defns:LineItem>
<defns:SupplierBrand/>
<defns:Store>ABC</defns:Store>
<defns:CPN>ABC</defns:CPN>
<defns:RetailUnits>2</defns:RetailUnits>
<defns:WholesaleUnits>0</defns:WholesaleUnits>
<defns:OnHandUnits>0</defns:OnHandUnits>
<defns:ServiceLevelKey>ABC</defns:ServiceLevelKey>
<defns:SupplierDesc>ABC</defns:SupplierDesc>
<defns:StyleDesc>ABC</defns:StyleDesc>
<defns:MSPN>ABC</defns:MSPN>
<defns:SizeDesc>ABC</defns:SizeDesc>
<defns:MarketGroup>ABC</defns:MarketGroup>
<defns:OnOrderUnits>0</defns:OnOrderUnits>
<defns:CommitUnits>0</defns:CommitUnits>
<defns:BackOrderUnits>0</defns:BackOrderUnits>
<defns:OrderUnits>0</defns:OrderUnits>
<defns:ReturnUnits>0</defns:ReturnUnits>
<defns:OrderActiveSKU>ABC</defns:OrderActiveSKU>
<defns:PalletQty>0</defns:PalletQty>
<defns:TireWeight>0</defns:TireWeight>
</defns:LineItem>
</defns:StockStatus>
[color=red]<defns:StockStatus sale_date="1960-01-03">[/color]
<defns:LineItem>
<defns:SupplierBrand>bbbb</defns:SupplierBrand>
<defns:Store>ABC</defns:Store>
<defns:CPN>ABC</defns:CPN>
<defns:RetailUnits>3</defns:RetailUnits>
<defns:WholesaleUnits>0</defns:WholesaleUnits>
<defns:OnHandUnits>0</defns:OnHandUnits>
<defns:ServiceLevelKey>ABC</defns:ServiceLevelKey>
<defns:SupplierDesc>ABC</defns:SupplierDesc>
<defns:StyleDesc>ABC</defns:StyleDesc>
<defns:MSPN>ABC</defns:MSPN>
<defns:SizeDesc>ABC</defns:SizeDesc>
<defns:MarketGroup>ABC</defns:MarketGroup>
<defns:OnOrderUnits>0</defns:OnOrderUnits>
<defns:CommitUnits>0</defns:CommitUnits>
<defns:BackOrderUnits>0</defns:BackOrderUnits>
<defns:OrderUnits>0</defns:OrderUnits>
<defns:ReturnUnits>0</defns:ReturnUnits>
<defns:OrderActiveSKU>ABC</defns:OrderActiveSKU>
<defns:PalletQty>0</defns:PalletQty>
<defns:TireWeight>0</defns:TireWeight>
</defns:LineItem>
</defns:StockStatus>
</defns:TIMSStockStatus>
<StockStatus sale_date="xxxx-xx-xx">
But in my actual xml output file, i am getting 1 <defns:StockStatus sale_date followed by 1 <defns:LineItem:> and 2nd <defns:StockStatus sale_date followed by 1 <defns:LineItem:>.
I know there is something need to work on the xpath expressing/arrangement, Please let me know the solution.
Thanks in advance,
Rajesh