diff --git a/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java b/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java index 053a967cd..f5982052e 100644 --- a/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java +++ b/src/main/java/com/fasterxml/jackson/dataformat/xml/ser/ToXmlGenerator.java @@ -1123,9 +1123,15 @@ public void writeNumber(BigDecimal dec) throws IOException } } else { if (_xmlPrettyPrinter != null) { - _xmlPrettyPrinter.writeLeafElement(_xmlWriter, - _nextName.getNamespaceURI(), _nextName.getLocalPart(), - dec); + if (usePlain) { + _xmlPrettyPrinter.writeLeafElement(_xmlWriter, + _nextName.getNamespaceURI(), _nextName.getLocalPart(), + dec.toPlainString(), false); + } else { + _xmlPrettyPrinter.writeLeafElement(_xmlWriter, + _nextName.getNamespaceURI(), _nextName.getLocalPart(), + dec); + } } else { _xmlWriter.writeStartElement(_nextName.getNamespaceURI(), _nextName.getLocalPart()); if (usePlain) {