Skip to Content
avatar image
Former Member

Java SAX mapping "&" problem

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    avatar image
    Former Member
    Jan 14, 2008 at 01:40 PM

    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á

    Add comment
    10|10000 characters needed characters exceeded