cancel
Showing results for 
Search instead for 
Did you mean: 

special charactors found in out put file of .xml file in file adapter

Former Member
0 Kudos

Hi ,

Dear all,

I am working on Sender File adapter picking files from the multiple Directories which are specified in a single CC and these files are placed in the different receiver directories in different CC's metained paths of the receivers

The Souce is XML.

When I use the receiver format as .csv,.txt it the out put is as excepted,when i give the receiver format as .XML the output file contents:PK (An invalid character was found in text content. Error processing resource 'file:).

Pl let me know how to tackle thsi situation.

Thanks,

Srini

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello Srinivasa,

Specify the character enconding at both sender and receiver side so that the file is successfully picked. The encoding must be in the xml declaration.

May this blog helps you ...,

https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]

***************Reward points ,if found useful

Former Member
0 Kudos

Srini,

I think you may have to change the encoding setting for your file adapter, using the suitable value for your file ...

Like ISO-8859-x (1, 2, ...)

default encoding should be UTF-8 I think

Rgds

chris

Former Member
0 Kudos

hi check the blog below by poojs pandey

https://weblogs.sdn.sap.com/pub/wlg/9420 [original link is broken] [original link is broken] [original link is broken]

Note: reward points if solution found helpfull

Regards

Chandrakanth.k

prateek
Active Contributor
0 Kudos

In the communication channel, provide File Encoding parameter as ISO-8859-1 and also provide appropriate file type e.g. text

Regards,

Prateek

Former Member
0 Kudos

I tried using the same in my xml payload,but no luck.

<?xml version="1.0" encoding='iso-8859-1'?>

<ns0:Emp xmlns:ns0="http://ehro.eds.com/SANDBOX/CutTest">

<Emp1>

<EName>sree</EName>

</Emp1>

</ns0:Emp>.

is there any other way?

The actual output i need to get sree

the output i am seeing PK

.

Former Member
0 Kudos

Hi,

the default encoding for a file adapter is UTF-8.

try with following configuration when receiver message protocal is file .

file type BINARY.

regards,

pradeep A.

Edited by: Pradeep Amisagadda on May 19, 2008 8:01 AM

prateek
Active Contributor
0 Kudos

Try with this header

<?xml version="1.0" encoding="ISO-8859-1"?>

Regards,

Prateek

Former Member
0 Kudos

Hi,

I tried tried thid way, <?xml version="1.0" encoding=="ISO-8859-1"?>.

There is no difference in the output of the file,

Srini

Former Member
0 Kudos

Hi,

Try using the file encoding as ISO 8859-2.

Regards,

Shabari

Former Member
0 Kudos

This is exact content of the output file.

PK ŽB°8 untitled.xml³±¯ÈÍQ(K-*ÎÌϳU2Ô3PRHÍKÎOÉÌK·U

qÓµP²·ã²É6°rÍ-P ªÎ¶ òlu20222JJ

¬ôõS3u0160òõRSu0160õu2019ósõu0192 ýœü#ôKKBRu2039Ku201Dìlu20ACu0161 ¤_bnª]qQjª>u201E¤Á2úPu201Cí PK !q y u0160 PK ŽB°8!q y u0160 untitled.xmlPK : ³

Former Member
0 Kudos

Hi Potharaju

http://jug.org.ua/wiki/display/JavaAlmanac/ConvertingCDATANodesintoTextNodesWhileParsinganXMLFile

This will really help u:

http://www.dpawson.co.uk/xsl/characters.html

Regards

Abhishek Mahajan

**Please Reward points if helpful***

Former Member
0 Kudos

Hi

Also try with the following UDF.

public class XmlUtil {

char[] specialCharacters = { '&', '<'>', '\'' };

String[] replacementStrings = { "&", "<">", "&apos;" };

public static String sanitizeText( String text ) {

StringBuffer buffer = new StringBuffer( text );

for( int i = 0; i < buffer.length(); i++ ) {

for( int k = 0; i < specialCharacters.length; k++ ) {

if( buffer.charAt(i) == specialCharacters[k] ) ) {

buffer.replace( i, i + 1, replacementString[k] );

i += replaceString[k].length;

} else if( (int)buffer.charAt(i) > 128 ) {

String replacement = "&#" + (int)buffer.charAt(i) + ";";

buffer.replace( i, i + 1, replacement );

i += replacement.length();

}

}

}

return buffer.toString();

}

Regards

Abhishek Mahajan