I'm generating OpenOffice XML using JAXB, and need to apply an xml:space="preserve"
attribute to a t
element.
<r>
<t>
foo
</t>
</r>
Should be
<r>
<t xml:space="preserve">
foo
</t>
</r>
I've used JAXB to generate Java classes from Open Office schemas. <t>
type is represented as a String in the CTRElt Java class, so there is no way to set this attribute. When I unmarshall from an existing document and marshall, previously existing space
attributes are no longer present.
The relevant portions of the schema are as follows:
<xsd:element name="t" type="ST_Xstring" minOccurs="1" maxOccurs="1">
<xsd:annotation>
<xsd:documentation>Text</xsd:documentation>
</xsd:annotation>
</xsd:element>
<xsd:simpleType name="ST_Xstring">
<xsd:annotation>
<xsd:documentation>Escaped String</xsd:documentation>
</xsd:annotation>
<xsd:restriction base="xsd:string" />
</xsd:simpleType>
How can I generate XML which has this required space
attribute? Modifying the schema is not an option. Do I need to customize JAXB?