From: Matt C. <mat...@va...> - 2009-06-15 13:09:55
|
Hi Florian, You might do better to customize the interface for binaryDataHandler in order to provide the array data as an Object that may be a Float[], Double[], Int32[], Int64[], and now String[]. Relying on your users to convert byte[] to the desired array type is a bit harsh, especially if it's compressed. But just having them check the type of the array before doing anything with it is easy and convenient. :) -Matt Florian Reisinger wrote: > Hi, > > due to requests for jmzml, the Java API for mzML we developed in the PRIDE team, we had to deal with > the 'binary' data elements in the BinaryDataArray. > > The default JAXB mapping of the xsd:base64Binary type to Java results in a byte[], which seems to > cause troubles when trying to convert with standard base64 algorithms as it does not produce the > expected result. > > I had to add an extension to the mzML schema defining the binary type to be of type "text/plain" > (see below), so the Java mapping would result in a String representation of the binary data instead > of a byte[]. The byte[] obtained from that String can then be converted to/from base64binary without > problem. > > The change in the schema is as follows: > > original: > <xs:element name="binary" type="xs:base64Binary"/> > > modified: > <xs:element name="binary" type="xs:base64Binary" xmime:expectedContentTypes="text/plain" > xmlns:xmime="http://www.w3.org/2005/05/xmlmime"/> > > > Now, I was wondering if someone else has experienced similar issues or if someone can see issues > with this modification of the schema (is there a potential issue with the schema specs? or should it > be defined in more detail in case there might be issues with other tools as well?). > > Also, I am not a expert in XML/Java mapping, so if there is an alternative/preferred way to handle > this type of data, I would be happy to know about it. > > Thanks, > Florian > |