cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in java mapping

Former Member
0 Kudos

Hello XI gurus,

I am using Java mapping program for one interface (File-to-File) because of the complexity of mapping rules. Java mapping is throwing error whenever it encounters & (ampersand) in the file data record.

For example if the record is like this:

Adam Smith 123456789 05/06/1977 543 J & CO LTD........

the mapping program is exiting here in this record becz of '&'. error is occurring in characters method in Java SAX Parser. if i remove this char it is working fine. I tried the same data with message mapping, it is working fine.

Anybody encountered this kind of error ? Please share....

Thanks

Pavan

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Pavan,

The SAX(or DOM) parser can only work on a valid XML character set. & is not a valid XML character. It has to be escaped thus in a XML file: &

Otherwise the XML file itself would not be able to be opened in a brower(or any XML reader).

So if your input XML has an unescaped '&' it is not a valid XML file.

The valid XML character set can be got at http://www.w3c.com

Thanks,

Anand

Former Member
0 Kudos

You need to escape characters for XML before parsing the file in your java mapping. You can use StringUtils class from Apache's commons-lang library.

Former Member
0 Kudos

check and see if you can use this...

Former Member
0 Kudos

Hi Pavan,

Check the following blogs:

Java mapping:

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-i

/people/prasad.ulagappan2/blog/2005/06/29/java-mapping-part-ii

Amaresh