else
{
// Parser should have had FATAL error for this.
String msg = "Badly formed XML? End element [" + endElemName.getLocalPart() + "] doesn't match expected start element [" + lastName.getLocalPart() + "].";
log.error( "consumeElementAndConvertToXmlString(): " + msg );
throw new ThreddsXmlParserException( "FATAL? " + msg );
}
}
event.writeAsEncodedUnicode( writerUsingWriteAsEncodedUnicode );
writerUsingToString.write( event.toString());
if ( nameList.isEmpty() )
break;
}
}
catch ( XMLStreamException e )
{
throw new ThreddsXmlParserException( "Problem reading unknown element [" + startLocation + "]. Underlying cause: " + e.getMessage(), e );
}
String result = writerUsingWriteAsEncodedUnicode.toString();
if ( result == null || result.length() == 0)
result = writerUsingToString.toString();