Results 1 to 2 of 2

Thread: StaxEventItemWriter creates invalid xml for zero row documents

  1. #1
    Join Date
    Mar 2008
    Posts
    4

    Default 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. #2

    Default

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

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •