Results 1 to 3 of 3

Thread: JAXB - Extra Characters added after the closing of the root tag

  1. #1
    Join Date
    Oct 2010
    Posts
    9

    Wink JAXB - Extra Characters added after the closing of the root tag

    When I marshal Java objects into XML, some extra characters are added after the closing of the root tag.

    Here is how I save the resulting java objects after unmarshaling from XML into a file:
    Code:
        public void saveStifBinConv(ConversionSet cs, String xmlfilename) {
            FileOutputStream os = null;
            try {
                os = new FileOutputStream(xmlfilename);
                this.marshaller.marshal(cs, new StreamResult(os));
            }
            catch (IOException e) {
                log.fatal("IOException when marshalling STIF Bin Conversion XML file");
                throw new WmrFatalException(e);
            }
            finally {
                if (os != null) {
                    try {
                        os.close();
                    }
                    catch (IOException e) {
                        log.fatal("IOException when closing FileOutputStream");
                        throw new WmrFatalException(e);
                    }
                }
            }
        }
    The extra characters are padded after closing tag of the root tag.

    The characters added are some of the characters from the XML. Example:
    Code:
    tractor-to-type><bin-code>239</bin-code><allowed>YES</allowed></extractor-to></extractor-mapping><extractor-mapping><e
    I use Spring OXM's `Jaxb2Marshaller` and JAXB 2.

    Thanks

  2. #2

    Default

    Those characters look like there were more XML tags to render, but the file writing stopped. Perhaps look at your platform and see if you still have filesystem space?

  3. #3
    Join Date
    Oct 2010
    Posts
    9

    Default

    There are no more XML tags to render, as the closing tag of the root tag has been printed. The extra characters trail the closing tag of the root tag at the end of the XML file.

Tags for this Thread

Posting Permissions

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