use of org.eclipse.persistence.internal.oxm.StrBuffer in project eclipselink by eclipse-ee4j.
the class UnmarshalRecordImpl method characters.
@Override
public void characters(char[] ch, int start, int length) throws SAXException {
if (currentObject == null) {
return;
}
try {
int strBufferInitialLength = -1;
if (null != selfRecords) {
strBufferInitialLength = getStringBuffer().length();
for (int x = 0, selfRecordsSize = selfRecords.size(); x < selfRecordsSize; x++) {
UnmarshalRecord selfRecord = selfRecords.get(x);
if (selfRecord != null) {
selfRecord.characters(ch, start, length);
} else {
getFragmentBuilder().characters(ch, start, length);
}
}
}
if (-1 != unmappedLevel && unmappedLevel <= levelIndex) {
return;
}
XPathNode textNode = xPathNode.getTextNode();
if (null == textNode) {
textNode = xPathNode.getAnyNode();
if (textNode != null) {
xpathNodeIsMixedContent = true;
this.xPathFragment.setLocalName(null);
this.xPathFragment.setNamespaceURI(null);
if (0 == length) {
return;
}
}
}
if (null != textNode) {
if (textNode.getUnmarshalNodeValue().isMixedContentNodeValue()) {
String tmpString = new String(ch, start, length);
if (!textNode.isWhitespaceAware() && tmpString.trim().length() == 0) {
return;
}
}
xPathNode = textNode;
unmarshalContext.characters(this);
}
NodeValue unmarshalNodeValue = xPathNode.getUnmarshalNodeValue();
if (null != unmarshalNodeValue && !unmarshalNodeValue.isWrapperNodeValue()) {
if (strBufferInitialLength == -1) {
getStringBuffer().append(ch, start, length);
} else {
StrBuffer strBuffer = getStringBuffer();
if (strBufferInitialLength == strBuffer.length()) {
strBuffer.append(ch, start, length);
}
}
}
} catch (EclipseLinkException e) {
if (null == xmlReader.getErrorHandler()) {
throw e;
} else {
SAXParseException saxParseException = new SAXParseException(null, getDocumentLocator(), e);
xmlReader.getErrorHandler().error(saxParseException);
}
}
}
Aggregations