diff --git a/javadoc/src/main/java/org/apache/cxf/xjc/javadoc/PropertyJavadoc.java b/javadoc/src/main/java/org/apache/cxf/xjc/javadoc/PropertyJavadoc.java
index 4ecc890b..b03b1538 100644
--- a/javadoc/src/main/java/org/apache/cxf/xjc/javadoc/PropertyJavadoc.java
+++ b/javadoc/src/main/java/org/apache/cxf/xjc/javadoc/PropertyJavadoc.java
@@ -63,7 +63,7 @@ public void addJavadocs() {
if (documentation == null || "".equals(documentation.trim())) {
return;
}
- setJavadoc(documentation.trim());
+ setJavadoc(documentation.replaceAll("^\\s+|\\s+$|\\s*(\n)\\s*|(\\s)\\s*", "$1$2"));
}
private XSComponent getDocumentedComponent(CPropertyInfo propertyInfo) {
diff --git a/javadoc/src/test/resources/complexTypeWithDocumentedAttribute.xsd b/javadoc/src/test/resources/complexTypeWithDocumentedAttribute.xsd
index 23cff9b1..c97377f1 100644
--- a/javadoc/src/test/resources/complexTypeWithDocumentedAttribute.xsd
+++ b/javadoc/src/test/resources/complexTypeWithDocumentedAttribute.xsd
@@ -28,5 +28,13 @@
Documentation of attribute
+
+
+
+ Multiline documentation of
+ attribute
+
+
+
\ No newline at end of file
diff --git a/javadoc/src/test/resources/complexTypeWithDocumentedProperties.xsd b/javadoc/src/test/resources/complexTypeWithDocumentedProperties.xsd
index 47829b76..f6c4f535 100644
--- a/javadoc/src/test/resources/complexTypeWithDocumentedProperties.xsd
+++ b/javadoc/src/test/resources/complexTypeWithDocumentedProperties.xsd
@@ -31,6 +31,14 @@
+
+
+
+ Some multiline documentation of
+ element
+
+
+
\ No newline at end of file