Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8158735

Unmarshal an image/png type JAXBElement from an xml file and then marshal back to xml, the png content is changed

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P3 P3
    • 9
    • 9
    • client-libs
    • None

      Create unmarshaller with the following xsd:
      <?xml version="1.0" encoding="UTF-8"?><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">
              <xs:import namespace="http://www.w3.org/2005/05/xmlmime" schemaLocation="xmime.xsd"/>
              <!-- as a value of JAXBElement -->
              <xs:element name="png" type="xs:base64Binary" xmime:expectedContentTypes="image/png"/>
      </xs:schema>

      and unmarshal the following xml:
      <?xml version="1.0" encoding="UTF-8"?>
            <png xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:xmime="http://www.w3.org/2005/05/xmlmime">iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAkElEQVR42qWT0Q3AIAhEGcRBXMRBHMRFHMRBXITmkmosRTHhEj6qxwtQJCJiZxDXWnkVvldTSomleu8cQrABRvIZABPMh+Q94DJ5D5BnENq5GuJOMUYfAC24AFDO+R6gnStV6IDxK7U7UcXf1FqbBgzOqMJeZQClSin3AK0KaL4F9DSWB6FM+nM/4l0s33N+AJVplWD8cBu5AAAAAElFTkSuQmCC</png>

      and then marshal back, but got png content:
      iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAmElEQVR4XqWT0Q3AIAhEGcRBXMRBHMRFHMRBXITmktIoYtV4CR+V4wlqiYj4MohzztwK360phNDloVorO+fWgEXxPwAmmFup4jlgs3gO0GsQxlHFNmAm770uPgNghCsAFGPcB1jrRhc2QK7SyqkuRlMp5TPg4LRUFyNAdpcAUCultA+wuoC+fwEzyeNBGCfd5SXeh9UbT+MBlWmVYI2LyuwAAAAASUVORK5CYII=

            jdv Jayathirth D V
            amjiang Amanda Jiang (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            10 Start watching this issue

              Created:
              Updated:
              Resolved: