on 10-01-2008 7:50 PM
Hi Folks,
i have a requiremnt like sending .TXT file and output is .XML.
when i open the file in internet explorer i Got right output. when open the same file in notepad the file is look like below
<?xml version="1.0" encoding="UTF-8"?>
<EDS_PII_XML><Header><FILE_DATE></FILE_DATE></Header><Employee><EMPLID>010203</EMPLID><LAST_NAME>PUBLIC</LAST_NAME><FIRST_NAME>JOHN</FIRST_NAME><Deductions><DEDUCTION_CODE>HM</DEDUCTION_CODE><RECORD_TYPE>A</RECORD_TYPE><BEGIN_DT>2009-01-01</BEGIN_DT><END_DT></END_DT><PRE_TAX_COST>33.48</PRE_TAX_COST><AFTER_TAX_COST>0.00</AFTER_TAX_COST><OPTION>KAHI</OPTION><COVERAGE_LEVEL>EF</COVERAGE_LEVEL><IMPUTED_INCOME>0.00
but i need the file like below:
<?xml version="1.0" encoding="UTF-8"?>
<EDS_PII_XML>
<Header>
<FILE_DATE></FILE_DATE>
</Header>
<Employee>
<EMPLID>010203</EMPLID>
<LAST_NAME>PUBLIC</LAST_NAME>
<FIRST_NAME>JOHN</FIRST_NAME>
<Deductions>
<DEDUCTION_CODE>HM</DEDUCTION_CODE>
<RECORD_TYPE>A</RECORD_TYPE>
<BEGIN_DT>2009-01-01</BEGIN_DT>
<END_DT/>
<PRE_TAX_COST>33.48</PRE_TAX_COST>
<AFTER_TAX_COST>0.00</AFTER_TAX_COST>
<OPTION>KAHI</OPTION>
<COVERAGE_LEVEL>EF</COVERAGE_LEVEL>
<IMPUTED_INCOME>0.00</IMPUTED_INCOME>
<GOAL_AMOUNT>0.00</GOAL_AMOUNT>
</Deductions>
<Deductions>
<DEDUCTION_CODE>HS</DEDUCTION_CODE>
<RECORD_TYPE>A</RECORD_TYPE>
<BEGIN_DT>2009-01-01</BEGIN_DT>
<END_DT/>
<PRE_TAX_COST>15.25</PRE_TAX_COST>
<AFTER_TAX_COST>0.00</AFTER_TAX_COST>
<OPTION>01</OPTION>
<COVERAGE_LEVEL>EF</COVERAGE_LEVEL>
<IMPUTED_INCOME>0.00</IMPUTED_INCOME>
<GOAL_AMOUNT>150.00</GOAL_AMOUNT>
Any conversion is there in XI?
please let me know ASAP.
points also rewarded.
Thanks
Anil M
Hi Anil,
You can do the conversion with XSLT. Here's the code:
<xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output encoding="utf-8" indent="yes" method="xml" version="1.0"/>
<xsl:strip-space elements="*"/>
<xsl:template match="@*|node()">
<xsl:copy>
<xsl:apply-templates select="@*|node()"/>
</xsl:copy>
</xsl:template>
</xsl:transform>
(This copies the complete XML, and created a formatted output - indent="yes". All other content remains untouched.)
How to integrate in SAP, read here: http://www.heidoc.net/joomla/en/technology-science/sap-and-xslt/5-tutorial-data-exchange-between-aba...
Best wishes,
Jan
Edited by: Jan Krohn on Jul 15, 2011 10:57 AM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi ,
As discussed and suggested by Aamir and Stefan, you have to use a newline charcter after each end tag.
For this purpose you need to write an UDF.
You can refer this link for this UDF.
https://www.sdn.sap.com/irj/sdn/wiki?path=/display/xi/howtoappendCarriageReturnintheendofeachtagofxml+file.
Regards
Aashish Sinha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
There is no standard for so-called whitespaces in XML, therefore PI does not provide any function to insert them automatically.
If you need line-feeds or tabs, then you have to provide them by a self-written Java mapping or XSLT mapping.
Regards
Stefan
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anil
Wrong Direction file ?
Provide more info on what exactly you are looking for with the output. So that we can try to solve.
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
IE can distingush XML with another files...that is the reason it showed you correctly, but Note pad don't have that feature... if there is a space between each tag than by using wrod wrap it can show you as IE,but in your file there will be no space after each tag.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Anil
You want to send text file or XML content in .txt file?
For converting XML into Txt you can use File Content Conversion in your Receiver Channel Configuration for File Adapter.
Thanks
Gaurav
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.