I know it is not exactly a Batch question but since it happens while using the StaxEventItemWriter...
I wish to write a nillable tag which is empty by just closing it like this :
but I get this instead:Code:<instituteID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"/>
from this xsd :Code:<instituteID xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:nil="true"> </instituteID>
Code:<xs:element name="instituteID" type="xs:string" nillable="true" />is my Writer Configuration.Code:<bean id="myDocumentItemWriter" class="org.springframework.batch.item.xml.StaxEventItemWriter" scope="step"> <property name="resource" value="file:#{jobParameters[output.file.name]}" /> <property name="marshaller" ref="myMarshaller" /> <property name="rootTagName" value="{http://www.myCompany.de/1_1}documents" /> <property name="overwriteOutput" value="true" /> <property name="saveState" value="false" /> </bean> <bean id="myMarshaller" class="org.springframework.oxm.jaxb.Jaxb2Marshaller"> <property name="contextPaths" value="some.model.context" /> <property name="schema" value="classpath:myXsd.xsd" /> <property name="marshallerProperties"> <map> <entry> <key> <util:constant static-field="javax.xml.bind.Marshaller.JAXB_FORMATTED_OUTPUT"/> </key> <value type="boolean">true</value> </entry> </map> </property> </bean>
Is my problem config related ? My knowledge of STAX / Parser internal stuff is limited, so I wonder if I am just missing something minor.... just searching the web did not help.
Additionally the Marshaller properties don't seem to be used since my output is still unformatted, though setting is true.


Reply With Quote