JAXB: How to keep consecutive spaces as they are in source XML during unmarshalling
问题 I am using JAXB to unmarshall an XML message. It seems to replace multiple consecutive spaces by a single space. <testfield>this is a test<\testfield> (several spaces between a and test) upon unmarshalling, the above becomes: this is test How do I keep consecutive spaces as they are in source XML? 回答1: From the msdn page: Document authors can use the xml:space attribute to identify portions of documents where white space is considered important. Style sheets can also use the xml:space