cancel
Showing results for 
Search instead for 
Did you mean: 

Java SAX mapping "&" problem

Former Member
0 Kudos

Hi, I'm using SAX mapping, but in case that some field has "&" as content, for example company name,

public void characters(char buf[], int offset, int len)

throws SAXException {

String s = new String(buf, offset, len);

}

for string "name m&s" returns only "s". It loops(splits this string into 3) trough:

1. "name m"

2. "&"

3. "s"

and in this case, I get only "s" what is completely wrong. How to avoid that?

br

mario

Accepted Solutions (1)

Accepted Solutions (1)

iprieto
Contributor
0 Kudos

Hi

Can you convert the character & to "& a m p ;" whithout white spaces?

"& a m p ;" is the correct value for some XML parsers, or try to use other character set.

Regards

Ivá

Former Member
0 Kudos

XML parser already replaces "&" with "&", which is OkK for me, but parser cals my character method 3 times but method endElement only once and with last value, which is wrong....

iprieto
Contributor
0 Kudos

Hi,

I need more information for helping you?

Could you reply me with more information about your problem?

Regards

Ivá

Former Member
0 Kudos

problem solved, I replaced "&" with "&" at correct position.

thx for help

points rewarded

Answers (0)