inconsistent values after unmarshaling
"Goudimenko, Nikolai" <[email protected]> Tue, 12 Aug 2003 08:36:58 -0500
| Newsgroups | gmane.comp.java.enhydra.zeus |
|---|---|
| Message-ID | <961266AE600F284B98071F1C28F64177053ABEEA@ro-msgmbx-01.roc.wesgroup.com> |
The ContentHandler interface that used to receive notification of the
logical content of a document has method public void characters(char[] ch,
int start, int length) throws SAXException. The Parser will call this
method to report each chunk of character data. SAX parsers may return all
contiguous character data in a single chunk, or they may split it into
several chunks; however, all of the characters in any single event must come
from the same external entity so that the Locator provides useful
information. The Zeus implementation of this method as follows:
public void characters(char[] ch, int start, int len)
throws SAXException {
// Feed this to the correct ContentHandler
Unmarshallable current = getCurrentUNode();
if (current != this) {
current.characters(ch, start, len);
return;
}
String text = new String(ch, start, len);
text = text.trim();
if (this.value == null) {
this.value = text;
} else {
this.value = new
StringBuffer(this.value).append(text).toString();
}
}
The xml input that parsed contains Elements like <arg
name="authority">Generic Authority</arg>
In some cases parser splits "Generic Authority" value into two different
chunks of data. When the trim() method is called it strips all white space
characters from the value, so combined values don't have white space
characters anymore. Can you recommend anything to avoid this limitation.