I have a recent problem with subsequent spaces. Im appending a text with subsequent spaces , to an XML element. the toXML method of Xom works fine but Writing thruogh a ByteArrayOutputStream with a Serializer is shrinking the spaces.
String textWithMultipleSpaces=" a b c ";
Element el=new Element("foo");
el.appendChild(textWithMultipleSpaces);
Document doc=new Document(el);
ByteArrayOutputStream out = new ByteArrayOutputStream();
Serializer serializer = new Serializer(out);
serializer.setIndent(indent);
serializer.setMaxLength(maxLength);
serializer.write(doc);
System.out.println(doc.toXML());
//<foo> a b c </foo>
System.out.println(out.toString());
//<foo> a b c </foo>
The subsequent spaces are shrinking to a single one. I cant find the reason
NOT: I see that the Xom Serializer is removing those whitespaces just because i use indent and setMaxLength. Is there a serializer that doesnt touch the text and do just indentation ?