Вася Патриков
Новичок
Есть xml-документ. И в этом xml-документе есть такой узел:
А в спецификации к этому документу сказано, что peaks - this element contains the m/z intensity pairs as base64 encoded binary data. This element can store raw as well as processed m/z - intensity pairs. The following attributes are defined for the peaks element:
- precision (required): the precision (in bits) of the binary floating point numbers encoded in the
element. This attribute can either have value 32 or 64.
- byteOrder (required): the byte order for the binary floating point numbers must be network.
- pairOrder (required): the order of the m/z - intensity pairs must be m/z-int.
- xsi:nil (optional): if there are no m/z – intensity pairs, but we want to have a scan element
anyway, the xsi:nil=”1” attribute can be set. It is important to remember to set the this attribute,
since an empty peaks will not meet the criteria of base64Binary type in the validation step.
The peaks element uses the following pattern ([A-Za-z0-9/\+=])* to restrict the xs:base64Binary
type. As a consequence the all base64 encoded binary data string must consist of one single line
without spaces!
Ну, допустим из base64 я раскодировать могу
А что дальше ? Я так полагаю, что нужно использовать unpack(), но как ? Я во все этой бинарной мути вообще ничего не понимаю...
PHP:
<peaks precision="32"
byteOrder="network"
contentType="m/z-int"
compressionType="none"
compressedLen="0" >QtH8O0QFhIhC5C3qRL8gqkLoGtJEG8WgQuwiPUNtPgRDAx3QROpGdEMGEBZDlgAAQxMW6kPFrGRDFh2DQ10srkMe9i9DmqWNQycozENu4bVDOv4zQ4UNu0Na77pEhT2+Q17niUNcshZDZi+yRAcCD0Nw6p1DnGj4Q4tzoESxe3xDi/NFQ+6hXUOMctNDawnZQ5ZxXERPEGpDpZtiQ8w35UOpb0xEnaHOQ6nuR0OcqB9DsnBHQ94ATEOzfRtEMJUNQ7P9eENVwgBDtGwgQ46gq0O0fiBEMSczQ7T+ZkOVBLVDtX3rQ+RmR0O1/gdDdWi6Q7Z9eEOigzNDx2sIQ+sw6EPQHZ5Dj4HHQ9BrsUO8JrZD22nkQ1BTqkPlZodDdzVVRAWxD0NwZTY=</peaks>
- precision (required): the precision (in bits) of the binary floating point numbers encoded in the
element. This attribute can either have value 32 or 64.
- byteOrder (required): the byte order for the binary floating point numbers must be network.
- pairOrder (required): the order of the m/z - intensity pairs must be m/z-int.
- xsi:nil (optional): if there are no m/z – intensity pairs, but we want to have a scan element
anyway, the xsi:nil=”1” attribute can be set. It is important to remember to set the this attribute,
since an empty peaks will not meet the criteria of base64Binary type in the validation step.
The peaks element uses the following pattern ([A-Za-z0-9/\+=])* to restrict the xs:base64Binary
type. As a consequence the all base64 encoded binary data string must consist of one single line
without spaces!
Ну, допустим из base64 я раскодировать могу

PHP:
$peak = <<<PEAK
QtH8O0QFhIhC5C3qRL8gqkLoGtJEG8WgQuwiPUNtPgRDAx3QROpGdEMGEBZDlgAAQxMW6kPFrGRDFh2DQ10srkMe9i9DmqWNQycozENu4bVDOv4zQ4UNu0Na77pEhT2+Q17niUNcshZDZi+yRAcCD0Nw6p1DnGj4Q4tzoESxe3xDi/NFQ+6hXUOMctNDawnZQ5ZxXERPEGpDpZtiQ8w35UOpb0xEnaHOQ6nuR0OcqB9DsnBHQ94ATEOzfRtEMJUNQ7P9eENVwgBDtGwgQ46gq0O0fiBEMSczQ7T+ZkOVBLVDtX3rQ+RmR0O1/gdDdWi6Q7Z9eEOigzNDx2sIQ+sw6EPQHZ5Dj4HHQ9BrsUO8JrZD22nkQ1BTqkPlZodDdzVVRAWxD0NwZTY=
PEAK;
$bin = base64_decode($peak);