I’m writing a JAXB class without XSD-compilation.
Can anybody please tell me the difference between
@XmlSchemaType(name = "normalizedString")
private String normalized;
and
@XmlJavaTypeAdapter(NormalizedStringAdapter.class)
private String normalized;
?
When the above annotation is used, the xsd:normalizedString type will be specified for the attribute/element corresponding to this property when an XML schema is generated.
The
NormalizedStringAdapterdoes the work during the unmarshal operation: line feeds, carriage returns, and tab characters are removed.Example
input.xml
Root
Demo
Output