Announcement Announcement Module
Collapse
No announcement yet.
StaxEventItemWriter creates invalid xml for zero row documents Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • StaxEventItemWriter creates invalid xml for zero row documents

    The seems to be a minor bug in org.springframework.batch.io.xml.StaxEventItemWrit er which causes it to generate invalid xml for output files that have zero rows e.g.

    <?xml version='1.0' encoding='UTF-8'?><modules</modules>

    rather than

    <?xml version='1.0' encoding='UTF-8'?><modules></modules>

    It looks like it is due to the frig in endDocument() which writes the end tag manually.

    I have subclassed it in my project and overridden the endDocument() and added another event to the writer (writer.add(factory.createCharacters(""))), to get round this problem. This extra 'useless' event seems to result in the startElement event being rendered correctly.

  • #2
    Thanks for pointing out, I've copy-pasted your description into a JIRA issue:

    http://jira.springframework.org/browse/BATCH-448

    Comment

    Working...
    X